/* ============================================
   EQUATION BALANCER — Component CSS
   DTC Tools Design System Extension
   ============================================ */

/* --- SR ONLY --- */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}

/* --- BREADCRUMB --- */
.eb-breadcrumb{padding:.75rem 0;border-bottom:1px solid var(--dtc-border)}
.eb-breadcrumb ol{list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;font-size:.85rem;color:var(--dtc-text-3)}
.eb-breadcrumb li:not(:last-child)::after{content:"›";margin-left:.4rem;color:var(--dtc-text-3)}
.eb-breadcrumb a{color:var(--dtc-text-2);font-weight:500}
.eb-breadcrumb a:hover{color:var(--dtc-primary)}
.eb-breadcrumb [aria-current]{color:var(--dtc-primary);font-weight:600}

/* --- HERO --- */
.eb-hero{padding:3.5rem 0 2rem;text-align:center}
.eb-hero__badge{display:inline-block;padding:.35rem 1rem;background:var(--dtc-primary-surface);color:var(--dtc-primary);border-radius:var(--r-full);font-size:.8rem;font-weight:700;letter-spacing:.5px;margin-bottom:1rem}
.eb-hero h1{font-size:clamp(2rem,5vw,3.2rem);line-height:1.15;letter-spacing:-.02em;background:linear-gradient(135deg,var(--dtc-primary-dark),var(--dtc-primary));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;margin-bottom:1rem}
.eb-hero__sub{font-size:1.1rem;color:var(--dtc-text-2);max-width:600px;margin:0 auto}

/* --- LAYOUT (CSS Grid) --- */
.eb-layout{display:grid;grid-template-columns:1fr;gap:3rem;padding-bottom:4rem;margin-top:1rem}

/* --- CALCULATOR CARD --- */
.eb-calc{background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border-radius:var(--r-xl);border:1px solid var(--glass-border);box-shadow:var(--sh-xl);padding:2.5rem;position:relative;overflow:visible;animation:fadeInUp .5s ease-out both}

/* Input */
.eb-calc__label{display:block;font-size:.8rem;font-weight:700;color:var(--dtc-text-2);text-transform:uppercase;letter-spacing:.8px;margin-bottom:.6rem}
.eb-calc__field{display:flex;align-items:center;gap:.5rem;background:#fff;border:2px solid var(--dtc-border);border-radius:var(--r-md);padding:0 1rem;transition:all .25s}
.eb-calc__field:focus-within{border-color:var(--dtc-primary);box-shadow:var(--sh-glow)}
.eb-calc__icon{color:var(--dtc-text-3);flex-shrink:0}
.eb-calc__input{flex:1;border:none;outline:none;padding:1rem .5rem;font-size:1.15rem;font-weight:700;font-family:var(--font-sans);color:var(--dtc-text);background:transparent}
.eb-calc__input::placeholder{color:var(--dtc-text-3);font-weight:400}
.eb-calc__clear{background:none;border:none;font-size:1.4rem;color:var(--dtc-text-3);cursor:pointer;padding:.25rem .5rem;line-height:1;border-radius:var(--r-sm);transition:all .2s}
.eb-calc__clear:hover{background:var(--dtc-surface-2);color:var(--dtc-text)}
.eb-calc__hint{font-size:.78rem;color:var(--dtc-text-3);margin-top:.5rem}
.eb-calc__hint kbd{background:var(--dtc-surface-2);padding:.1rem .4rem;border-radius:3px;font-size:.75rem;border:1px solid var(--dtc-border);font-family:monospace}

/* Actions */
.eb-calc__actions{margin-top:1.25rem;display:flex;justify-content:center}
.eb-calc__submit{background:var(--dtc-primary);color:#fff;border:none;padding:.9rem 2.5rem;font-size:1rem;font-weight:700;border-radius:var(--r-full);cursor:pointer;display:inline-flex;align-items:center;gap:.5rem;box-shadow:0 4px 14px rgba(15,124,120,.3);transition:all .3s cubic-bezier(.34,1.56,.64,1)}
.eb-calc__submit:hover{background:var(--dtc-primary-dark);transform:translateY(-2px);box-shadow:0 8px 24px rgba(15,124,120,.4)}
.eb-calc__submit:active{transform:translateY(0)}

/* Pills */
.eb-pills{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:1.5rem;padding-top:1.25rem;border-top:1px dashed var(--dtc-border)}
.eb-pills__label{font-size:.8rem;font-weight:600;color:var(--dtc-text-3)}
.eb-pill{background:var(--dtc-surface-2);border:1px solid var(--dtc-border);border-radius:var(--r-full);padding:.35rem .9rem;font-size:.8rem;font-weight:600;color:var(--dtc-text-2);cursor:pointer;transition:all .2s;font-family:var(--font-sans)}
.eb-pill:hover{background:var(--dtc-primary-surface);border-color:var(--dtc-primary);color:var(--dtc-primary);transform:translateY(-1px)}

/* Error */
.eb-error{margin-top:1rem;padding:1rem 1.25rem;background:#fef2f2;border:1px solid #fecaca;border-radius:var(--r-md);color:#dc2626;font-weight:600;font-size:.9rem;text-align:center}

/* Result */
.eb-result{margin-top:1.5rem;background:linear-gradient(135deg,#f0fdfa 0%,#ffffff 100%);border:1px solid rgba(20,184,166,.3);border-radius:12px;padding:1.75rem;box-shadow:0 2px 12px rgba(15,124,120,.08)}
.eb-result__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.75rem}
.eb-result__badge{font-size:.75rem;font-weight:700;color:var(--dtc-primary);background:var(--dtc-primary-surface);padding:.25rem .75rem;border-radius:var(--r-full);letter-spacing:.5px}
.eb-result__copy{background:none;border:1px solid var(--dtc-border);border-radius:var(--r-sm);padding:.4rem;cursor:pointer;color:var(--dtc-text-3);transition:all .2s;line-height:0}
.eb-result__copy:hover{border-color:var(--dtc-primary);color:var(--dtc-primary)}
.eb-result__equation{font-size:clamp(1.2rem,3vw,1.8rem);font-weight:700;text-align:center;padding:1.25rem 0;font-family:var(--font-sans);letter-spacing:.3px;color:var(--dtc-text)}
.eb-coeff{color:var(--dtc-primary);font-weight:800;font-size:1.1em}
.eb-op{color:var(--dtc-text-3);margin:0 .25rem}
.eb-arrow{color:var(--dtc-primary);margin:0 .5rem;font-weight:800}
.eb-result__equation sub{font-size:.65em;color:var(--dtc-text-2)}
.eb-result__verify{display:flex;flex-wrap:wrap;justify-content:center;gap:.75rem;margin-top:1rem;padding-top:1rem;border-top:1px dashed var(--dtc-border)}
.eb-verify{display:flex;flex-direction:column;align-items:center;background:#fff;padding:.6rem 1rem;border-radius:var(--r-md);border:1px solid var(--dtc-border);min-width:64px;transition:all .2s}
.eb-verify:hover{border-color:var(--dtc-primary);box-shadow:var(--sh-sm)}
.eb-verify__el{font-size:.75rem;font-weight:700;color:var(--dtc-primary);text-transform:uppercase}
.eb-verify__count{font-size:1.25rem;font-weight:800;color:var(--dtc-text)}
.eb-verify__ok{font-size:.7rem;color:#16a34a;font-weight:700}

/* History */
.eb-history{margin-top:1.5rem;padding-top:1.25rem;border-top:1px solid var(--dtc-border)}
.eb-history__title{display:flex;align-items:center;gap:.5rem;font-size:.85rem;font-weight:700;color:var(--dtc-text-3);margin-bottom:.75rem}
.eb-history__list{list-style:none;display:flex;flex-direction:column;gap:.4rem}
.eb-history__item{width:100%;display:flex;justify-content:space-between;align-items:center;background:var(--dtc-surface-2);border:1px solid var(--dtc-border);border-radius:var(--r-sm);padding:.5rem 1rem;font-size:.85rem;cursor:pointer;transition:all .2s;font-family:var(--font-sans);color:var(--dtc-text)}
.eb-history__item:hover{border-color:var(--dtc-primary);background:var(--dtc-primary-surface)}
.eb-history__time{font-size:.7rem;color:var(--dtc-text-3)}

/* --- CONTENT ARTICLE --- */
.eb-content{background:#fff;border-radius:var(--r-lg);border:1px solid var(--dtc-border);box-shadow:var(--sh-xs);padding:2.5rem;animation:fadeInUp .5s ease-out .1s both}
.eb-content h2{font-size:1.6rem;margin:2rem 0 1rem;display:flex;align-items:center;gap:.75rem;color:var(--dtc-text)}
.eb-content h2::before{content:'';width:6px;height:28px;background:var(--dtc-primary);border-radius:3px;flex-shrink:0}
.eb-content h3{color:var(--dtc-primary);font-size:1.15rem;margin:1.25rem 0 .5rem}
.eb-content>p{color:var(--dtc-text-2);font-size:1rem;line-height:1.7;margin-bottom:1.25rem}

/* Steps */
.eb-steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;margin:1.5rem 0 2rem}
.eb-step{display:flex;gap:1rem;padding:1.25rem;background:var(--dtc-surface-2);border-radius:var(--r-md);border:1px solid var(--dtc-border);transition:all .25s}
.eb-step:hover{border-color:var(--dtc-primary);box-shadow:var(--sh-sm);transform:translateY(-2px)}
.eb-step__num{width:36px;height:36px;min-width:36px;display:flex;align-items:center;justify-content:center;background:var(--dtc-primary);color:#fff;border-radius:50%;font-weight:800;font-size:.9rem}
.eb-step h3{font-size:.95rem;margin-bottom:.25rem}
.eb-step p{font-size:.85rem;color:var(--dtc-text-2);line-height:1.5}

/* Example */
.eb-example{background:linear-gradient(to right,#fffbeb,#fef3c7);border:1px solid #fcd34d;border-radius:var(--r-lg);padding:1.5rem;margin:1.5rem 0}
.eb-example h3{color:#92400e;margin:0 0 1rem}
.eb-example__eq{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:1rem;margin-bottom:1rem}
.eb-example__before,.eb-example__after{padding:1rem;border-radius:var(--r-md);text-align:center}
.eb-example__before{background:rgba(255,255,255,.7);border:1px dashed #d97706}
.eb-example__after{background:rgba(255,255,255,.9);border:2px solid #16a34a}
.eb-example__tag{display:block;font-size:.7rem;font-weight:700;color:#92400e;text-transform:uppercase;letter-spacing:.5px;margin-bottom:.35rem}
.eb-example__tag--ok{color:#16a34a}
.eb-example code{font-size:1.1rem;font-weight:600;color:var(--dtc-text)}
.eb-example__arrow{color:#d97706;flex-shrink:0}
.eb-example>p{font-size:.85rem;color:#78350f;text-align:center;margin:0}

/* FAQ */
.eb-faq{display:flex;flex-direction:column;gap:.6rem;margin-top:1rem}
.eb-faq__item{border:1px solid var(--dtc-border);border-radius:var(--r-md);overflow:hidden;transition:all .2s}
.eb-faq__item[open]{border-color:var(--dtc-primary);box-shadow:var(--sh-sm)}
.eb-faq__item summary{padding:1rem 1.25rem;font-weight:700;cursor:pointer;font-size:.95rem;color:var(--dtc-text);list-style:none;display:flex;align-items:center;justify-content:space-between}
.eb-faq__item summary::after{content:"+";font-size:1.2rem;color:var(--dtc-primary);font-weight:700;transition:transform .2s}
.eb-faq__item[open] summary::after{content:"−"}
.eb-faq__item summary::-webkit-details-marker{display:none}
.eb-faq__item p{padding:0 1.25rem 1rem;color:var(--dtc-text-2);font-size:.9rem;line-height:1.6}

/* Author */
.eb-author{display:flex;align-items:center;gap:1.5rem;padding:2rem;background:linear-gradient(to right,#fff,#f0fdfa);border:1px solid var(--dtc-border);border-radius:var(--r-xl);margin:2rem 0;box-shadow:var(--sh-sm)}
.eb-author img{width:96px;height:96px;border-radius:50%;border:3px solid #fff;box-shadow:var(--sh-sm);object-fit:cover;flex-shrink:0}
.eb-author__role{color:var(--dtc-primary);font-weight:700;font-size:.8rem;text-transform:uppercase;letter-spacing:.8px;margin-bottom:.2rem}
.eb-author h3{font-size:1.25rem;margin-bottom:.35rem}
.eb-author h3 a{color:var(--dtc-text)}
.eb-author p:last-child{color:var(--dtc-text-2);font-size:.9rem;line-height:1.6}

/* Related Tools */
.eb-related{margin-top:2rem;padding-top:2rem;border-top:1px solid var(--dtc-border)}
.eb-related h3{font-size:1.1rem;margin-bottom:1rem;color:var(--dtc-text)}
.eb-related__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.75rem}
.eb-related__card{display:flex;align-items:center;gap:.75rem;padding:1rem;background:var(--dtc-surface-2);border:1px solid var(--dtc-border);border-radius:var(--r-md);font-size:.9rem;font-weight:600;color:var(--dtc-text);transition:all .25s}
.eb-related__card:hover{border-color:var(--dtc-primary);background:var(--dtc-primary-surface);color:var(--dtc-primary);transform:translateY(-2px);box-shadow:var(--sh-sm)}
.eb-related__icon{font-size:1.4rem}

/* --- RESPONSIVE --- */
@media(max-width:768px){
    .eb-hero{padding:2.5rem 0 1.5rem}
    .eb-calc{padding:1.5rem}
    .eb-content{padding:1.5rem}
    .eb-author{flex-direction:column;text-align:center}
    .eb-example__eq{flex-direction:column}
    .eb-steps{grid-template-columns:1fr}
}
@media(max-width:480px){
    .eb-calc__input{font-size:1rem}
    .eb-result__equation{font-size:1.1rem}
}

/* REDOX BALANCER SPECIFIC STYLES */
.redox-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: 16px;
    width: 100%;
    border-bottom: 2px solid var(--c-border);
    padding-bottom: 8px;
}
.redox-step {
    width: 100%;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.redox-step h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}
.redox-step-content {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.6;
}
.half-rxn, .multiplier-box {
    background: #f8f9fa;
    border-left: 3px solid var(--c-accent);
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    font-family: 'DM Mono', monospace;
    font-size: 0.95rem;
}
.rxn-row {
    margin-bottom: 8px;
}
.rxn-row:last-child {
    margin-bottom: 0;
}
.rxn-row strong {
    color: var(--c-primary);
    font-size: 1.1rem;
}

/* NET IONIC EQUATION SPECIFIC STYLES */
.ionic-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: 16px;
    width: 100%;
    border-bottom: 2px solid var(--c-border);
    padding-bottom: 8px;
}
.ionic-step {
    width: 100%;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.ionic-step h4 {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ionic-step-content {
    font-size: 1rem;
    color: #1a1410;
    line-height: 1.8;
    font-family: 'DM Mono', monospace;
}
.state-tag {
    font-size: 0.75rem;
    color: #888;
    vertical-align: sub;
    margin-left: 2px;
}
.spectator-ion {
    color: #aaa;
    text-decoration: line-through;
    text-decoration-color: #ff4d4f;
    text-decoration-thickness: 2px;
}
.ionic-spectators {
    font-size: 0.85rem;
    color: #e65100;
    background: #fff3e0;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 100%;
}
.ionic-spectators code {
    background: rgba(230,81,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'DM Mono', monospace;
}
.highlight-net {
    font-size: 1.15rem;
    color: #0f7c78;
    font-weight: 700;
}

/* DETAIL BREAKDOWN LAYOUT */
.eb-result__details {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--dtc-border);
    width: 100%;
}

/* OVERFLOW FIXES */
.eb-result__equation {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem; /* space for scrollbar */
}
.ionic-step-content, .redox-step-content, .half-rxn, .multiplier-box {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
}
/* Ensure the result container doesn't stretch infinitely */
.eb-result {
    max-width: 100%;
    overflow: hidden;
}
/* Also fix variable names in ionic/redox css */
.ionic-title, .redox-title {
    color: var(--dtc-primary) !important;
    border-bottom: 2px solid var(--dtc-border) !important;
}
.ionic-step, .redox-step {
    border: 1px solid var(--dtc-border) !important;
}
