/* ==========================================================================
   SpecInfo ACPI Battery Health & Cell Imbalance Visualizer Stylesheet
   Design System: Dark Glassmorphism, Neon Telemetry Accents, Responsive 2-Col
   ========================================================================== */

:root {
    --bg-base: #020617;
    --bg-surface: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-glass: rgba(15, 23, 42, 0.65);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.16);
    --border-glow: rgba(16, 185, 129, 0.3);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --clr-emerald: #10b981;
    --clr-cyan: #06b6d4;
    --clr-sky: #38bdf8;
    --clr-amber: #f59e0b;
    --clr-rose: #f43f5e;
    --clr-purple: #a855f7;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.battery-app {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(16, 185, 129, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(56, 189, 248, 0.08), transparent);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.battery-container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 30px 24px 80px;
    width: 100%;
}

/* Top Navigation Bar */
.battery-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.nav-link-btn:hover {
    color: var(--text-primary);
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-1px);
}

.nav-link-btn.highlight {
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--clr-emerald);
    background: rgba(16, 185, 129, 0.08);
}

/* Header */
.battery-header {
    text-align: center;
    margin-bottom: 35px;
}

.battery-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-full);
    color: var(--clr-emerald);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--clr-emerald);
    box-shadow: 0 0 10px var(--clr-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.battery-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
}

.battery-title span {
    background: linear-gradient(135deg, #10b981 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.battery-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 820px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* Presets Strip */
.presets-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    padding: 12px 18px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
}

.presets-label {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 6px;
}

.preset-pill {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.preset-pill:hover {
    color: var(--text-primary);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
}

.preset-pill.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--clr-emerald);
    color: var(--clr-emerald);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

/* Main 2-Column Grid */
.battery-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 24px;
    align-items: start;
}

/* Config Cards */
.config-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-heading {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-badge-live {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--clr-emerald);
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

/* Dropzone */
.dropzone {
    border: 2px dashed rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    background: rgba(16, 185, 129, 0.03);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--clr-emerald);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 2.4rem;
}

.dropzone-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dropzone-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 320px;
}

.dropzone-input {
    display: none;
}

.dropzone-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--clr-emerald);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
}

/* Manual Fields */
.fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.field-val-hint {
    font-family: var(--font-mono);
    color: var(--clr-emerald);
    font-weight: 700;
}

.input-control {
    background: #050811;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.input-control:focus {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.select-control {
    background: #050811;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.select-control:focus {
    border-color: rgba(16, 185, 129, 0.4);
}

/* Telemetry Display Column */
.telemetry-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Primary Hero Gauge Card */
.gauge-hero-card {
    background: #050811;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: center;
}

.gauge-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.gauge-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 12;
}

.gauge-bar {
    fill: none;
    stroke: var(--clr-emerald);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 471;
    stroke-dashoffset: 47;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
}

.gauge-center-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-pct {
    font-size: 2.2rem;
    font-weight: 900;
    font-family: var(--font-mono);
    line-height: 1;
    color: var(--text-primary);
}

.gauge-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.gauge-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.itad-grade-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.itad-badge {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.itad-badge.grade-a {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--clr-emerald);
    color: var(--clr-emerald);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.itad-badge.grade-b {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--clr-amber);
    color: var(--clr-amber);
}

.itad-badge.grade-c {
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--clr-rose);
    color: var(--clr-rose);
}

.itad-grade-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-pill {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
}

.stat-pill-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.stat-pill-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
}

/* Gas Gauge Diagnosis Card */
.diag-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(16px);
}

.diag-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.diag-icon {
    font-size: 1.3rem;
}

.diag-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.diag-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.diag-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.6);
    font-size: 0.82rem;
}

.diag-box.recalibrate {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
}

.diag-box.ok {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.diag-box.replace {
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.08);
}

/* Cell Imbalance Grid */
.cells-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(16px);
}

.cells-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.cells-title {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.delta-badge {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.delta-badge.balanced { background: rgba(16, 185, 129, 0.15); color: var(--clr-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.delta-badge.warning { background: rgba(245, 158, 11, 0.15); color: var(--clr-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.delta-badge.critical { background: rgba(244, 63, 94, 0.15); color: var(--clr-rose); border: 1px solid rgba(244, 63, 94, 0.3); }

.cells-matrix {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.cell-box {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cell-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.cell-voltage {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.cell-bar-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.cell-bar-fill {
    height: 100%;
    background: var(--clr-emerald);
    border-radius: 3px;
    transition: width 0.4s ease, background-color 0.4s ease;
}

/* History Chart Card */
.chart-card {
    background: #050811;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 16px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.chart-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.design { background: rgba(255, 255, 255, 0.4); }
.legend-dot.threshold { background: var(--clr-amber); }
.legend-dot.actual { background: var(--clr-emerald); box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }

.chart-svg-wrap {
    width: 100%;
    height: 165px;
    position: relative;
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .battery-grid {
        grid-template-columns: 1fr;
    }
    .gauge-hero-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .itad-grade-row {
        justify-content: center;
    }
    .stat-pills-row {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .battery-title {
        font-size: 2rem;
    }
    .battery-container {
        padding: 20px 14px 60px;
    }
    .cells-matrix {
        grid-template-columns: 1fr 1fr;
    }
}
