/* =============================================================================
   Focus Mode — Dark Immersive
   Scope: Ground page (#ground-page-root) — 100% replica of focus_ground.html
   ============================================================================= */

/* ---- Normal state: enable background transition ---- */
#ground-page-root {
    transition: background 0.6s ease;
}

/* ---- Focus active: deep dark background ---- */
#ground-page-root.focus-active {
    background: #0b1120 !important;   /* override Bootstrap .bg-light !important */
}

/* ---- Vignette overlay ---- */
#ground-page-root.focus-active::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Content above vignette */
#ground-page-root.focus-active > .container-fluid {
    position: relative;
    z-index: 2;
}

/* ---- Title bar ---- */
#ground-page-root.focus-active .gnd-title-bar {
    border-bottom-color: rgba(148,163,184,0.15);
}
#ground-page-root.focus-active .gnd-title-bar h5 {
    color: #e2e8f0;
    text-shadow: 0 0 20px rgba(14,165,233,0.3);
}
#ground-page-root.focus-active .gnd-title-bar small {
    color: #64748b;
}

/* ---- Hide: step pipeline ---- */
#ground-page-root.focus-active .gnd-step-pipeline {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ---- Hide: mode tabs ---- */
#ground-page-root.focus-active .gnd-mode-tabs {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ---- Hide: input panels (by ID, preserve #gnd-panel-api) ---- */
#ground-page-root.focus-active #gnd-panel-direct {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0;
}
#ground-page-root.focus-active #gnd-panel-ipmu {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0;
}

/* ---- Hide: calc button ---- */
#ground-page-root.focus-active .gnd-btn-analyze {
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ---- Cards: bright on dark, elevated ---- */
#ground-page-root.focus-active .gnd-result-section {
    background: #ffffff;
    border-color: rgba(148,163,184,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
}

/* ---- Work card: transparent wrapper when children collapsed ---- */
#ground-page-root.focus-active .gnd-work-card {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* ---- API panel: own white card styling (work-card is now transparent) ---- */
#ground-page-root.focus-active #gnd-panel-api {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(148,163,184,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
}

/* ---- Side cards: blue glow accent ---- */
#ground-page-root.focus-active .gnd-side-card {
    background: #ffffff;
    border-color: rgba(14,165,233,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 15px rgba(14,165,233,0.06);
}

/* ---- Chart area: inner glow ---- */
#ground-page-root.focus-active .gnd-chart {
    background: #f1f5f9;
    border-color: rgba(14,165,233,0.2);
    box-shadow: inset 0 0 20px rgba(14,165,233,0.04);
}

/* ---- Result table: dark header ---- */
#ground-page-root.focus-active .gnd-result-table th {
    background: #0f172a;
    color: #94a3b8;
    border-color: #1e293b;
}
#ground-page-root.focus-active .gnd-result-table td {
    background: #fff;
    color: #1e293b;
    font-weight: 500;
}

/* ---- Diagnostic badge: dark green ---- */
#ground-page-root.focus-active .gnd-diag-badge.ok {
    background: #064e3b;
    color: #6ee7b7;
}

/* ---- Tabs: fill full width (override inline-flex → flex) ---- */
#ground-page-root .gnd-mode-tabs {
    display: flex;
}

/* ---- Focus Toggle Button ---- */
.focus-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    outline: none;
}

.focus-toggle-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.focus-toggle-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    box-shadow: 0 0 16px rgba(37,99,235,0.4);
}

/* ---- Ground transitions ---- */
.gnd-result-section,
.gnd-side-card,
.gnd-work-card,
.gnd-chart,
.gnd-step-pipeline,
.gnd-mode-tabs,
#gnd-panel-direct,
#gnd-panel-ipmu,
.gnd-title-bar,
.gnd-title-bar h5,
.gnd-title-bar small,
.gnd-result-table th,
.gnd-result-table td,
.gnd-diag-badge {
    transition: all 0.5s ease;
}

/* =============================================================================
   Focus Mode — Analysis page (#analysis-page-root)
   ============================================================================= */

/* ---- Normal state: enable background transition ---- */
#analysis-page-root {
    transition: background 0.6s ease;
}

/* ---- Focus active: deep dark background ---- */
#analysis-page-root.focus-active {
    background: #0b1120 !important;
}

/* ---- Vignette overlay ---- */
#analysis-page-root.focus-active::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Content above vignette */
#analysis-page-root.focus-active > .container-fluid {
    position: relative;
    z-index: 2;
}

/* ---- Title bar ---- */
#analysis-page-root.focus-active .analysis-title-bar h5 {
    color: #e2e8f0 !important;
    text-shadow: 0 0 20px rgba(14,165,233,0.3);
}
#analysis-page-root.focus-active .analysis-title-bar small {
    color: #64748b;
}

/* ---- Hide: right sidebar ---- */
#analysis-page-root.focus-active #analysis-right-sidebar {
    opacity: 0;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 0 !important;
}

/* ---- Expand: main column to full width ---- */
#analysis-page-root.focus-active .analysis-main-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

/* ---- Input card wrapper: transparent ---- */
#analysis-page-root.focus-active .analysis-main-col > .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ---- Hide: input tabs ---- */
#analysis-page-root.focus-active #input-tabs {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

/* ---- Hide: all input elements in manual panel ---- */
#analysis-page-root.focus-active #panel-manual > * {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}

/* ---- Show: result container ---- */
#analysis-page-root.focus-active #result-container {
    opacity: 1;
    max-height: none;
    overflow: visible;
    margin: 0 !important;
}

/* ---- Hide: batch and API panels ---- */
#analysis-page-root.focus-active #panel-batch,
#analysis-page-root.focus-active #panel-api {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 !important;
}

/* ---- Reduce manual panel top padding ---- */
#analysis-page-root.focus-active #panel-manual {
    padding-top: 0 !important;
}

/* ---- Charts: white cards with blue glow ---- */
#analysis-page-root.focus-active .phasor-chart,
#analysis-page-root.focus-active .seq-chart {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(14,165,233,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(14,165,233,0.08);
}

/* ---- Center fixed-width Plotly charts within containers ---- */
#analysis-page-root.focus-active .phasor-chart .svg-container,
#analysis-page-root.focus-active .seq-chart .svg-container {
    margin-left: auto;
    margin-right: auto;
}

/* ---- Result tables: dark header ---- */
#analysis-page-root.focus-active .result-data-table th,
#analysis-page-root.focus-active .current-result-table th {
    background: #0f172a;
    color: #94a3b8;
    border-color: #1e293b;
}
#analysis-page-root.focus-active .result-data-table td,
#analysis-page-root.focus-active .current-result-table td {
    background: #fff;
    color: #1e293b;
    font-weight: 500;
}

/* ---- Rotation toolbar: dark card with blue glow ---- */
#analysis-page-root.focus-active .rotation-toolbar {
    background: #0f172a;
    border-color: rgba(14,165,233,0.2);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5), 0 0 15px rgba(14,165,233,0.06);
}
#analysis-page-root.focus-active .angle-display {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
#analysis-page-root.focus-active .angle-display.rotated {
    background: rgba(14,165,233,0.1);
    border-color: rgba(14,165,233,0.4);
    color: #38bdf8;
    box-shadow: 0 0 8px rgba(14,165,233,0.25);
}
#analysis-page-root.focus-active .btn-rotate {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}
#analysis-page-root.focus-active .btn-rotate:hover {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: rgba(14,165,233,0.1);
}
#analysis-page-root.focus-active .res-btn {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}
#analysis-page-root.focus-active .res-btn.active {
    background: #0ea5e9;
    color: #fff;
}
#analysis-page-root.focus-active .btn-rotate-reset {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
}
#analysis-page-root.focus-active .btn-rotate-reset:hover {
    border-color: #f59e0b;
    color: #f59e0b;
}

/* ---- Analysis transitions ---- */
#analysis-right-sidebar,
.analysis-main-col,
#input-tabs,
#panel-manual,
#panel-batch,
#panel-api,
.phasor-chart,
.seq-chart,
.result-data-table th,
.result-data-table td,
.current-result-table th,
.current-result-table td,
.rotation-toolbar,
.angle-display,
.btn-rotate,
.res-btn,
.btn-rotate-reset {
    transition: all 0.5s ease;
}

/* =============================================================================
   Focus Mode — Insulation page (#insul-page-root)
   ============================================================================= */

/* ---- Normal state: enable background transition ---- */
#insul-page-root {
    transition: background 0.6s ease;
}

/* ---- Focus active: deep dark background ---- */
#insul-page-root.focus-active {
    background: #0b1120 !important;
}

/* ---- Vignette overlay ---- */
#insul-page-root.focus-active::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.35) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Content above vignette */
#insul-page-root.focus-active > .container-fluid {
    position: relative;
    z-index: 2;
}

/* ---- Title bar ---- */
#insul-page-root.focus-active .insul-title-bar {
    border-bottom-color: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .insul-title-bar h5 {
    color: #e2e8f0 !important;
    text-shadow: 0 0 20px rgba(14,165,233,0.3);
}
#insul-page-root.focus-active .insul-title-bar small {
    color: #64748b;
}

/* ---- Hide: Health Strip ---- */
#insul-page-root.focus-active .insul-health-strip {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ---- Metrics Bar: dark styling ---- */
#insul-page-root.focus-active .insul-metrics-viewport {
    background: #111827;
    border-color: rgba(14,165,233,0.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 10px rgba(14,165,233,0.05);
}
#insul-page-root.focus-active .insul-metric-card {
    background: transparent;
}
#insul-page-root.focus-active .insul-metric-card:hover {
    background: rgba(255,255,255,0.04);
}
#insul-page-root.focus-active .insul-metric-card.selected {
    background: rgba(14,165,233,0.08);
}
#insul-page-root.focus-active .insul-metric-card:not(:last-child)::after {
    background: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .insul-metric-value {
    color: #e2e8f0;
    text-shadow: 0 0 8px rgba(14,165,233,0.25);
}
#insul-page-root.focus-active .insul-metric-label,
#insul-page-root.focus-active .insul-metric-symbol,
#insul-page-root.focus-active .insul-metric-unit,
#insul-page-root.focus-active .insul-metric-sub {
    color: #64748b;
}
#insul-page-root.focus-active .insul-metrics-arrow {
    background: #1e293b;
    border-color: rgba(148,163,184,0.2);
    color: #94a3b8;
}

/* ---- Section backgrounds: transparent on dark ---- */
#insul-page-root.focus-active .insul-section-trends,
#insul-page-root.focus-active .insul-section-correlation,
#insul-page-root.focus-active .insul-section-alerts {
    background: transparent;
}

/* ---- sec-card: dark with blue glow ---- */
#insul-page-root.focus-active .sec-card {
    background: #111827;
    border-color: rgba(14,165,233,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(14,165,233,0.08);
}

/* ---- sec-hd: light text on dark ---- */
#insul-page-root.focus-active .sec-hd {
    border-bottom-color: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .sec-hd h6 {
    color: #e2e8f0;
}

/* ---- Scatter tabs: dark variant ---- */
#insul-page-root.focus-active .insul-scatter-tab {
    border-color: rgba(148,163,184,0.2);
    color: #94a3b8;
}
#insul-page-root.focus-active .insul-scatter-tab:hover {
    color: #e2e8f0;
    border-color: #64748b;
}

/* ---- Radio group: dark variant ---- */
#insul-page-root.focus-active .insul-radio-group {
    background: rgba(255,255,255,0.08);
}
#insul-page-root.focus-active .insul-radio-group .form-check-label {
    color: #94a3b8;
}

/* ---- Baseline button: dark variant ---- */
#insul-page-root.focus-active .insul-btn-baseline {
    border-color: rgba(148,163,184,0.2) !important;
    color: #94a3b8 !important;
}

/* ---- Correlation section: dark text ---- */
#insul-page-root.focus-active .corr-name {
    color: #e2e8f0;
}
#insul-page-root.focus-active .corr-pattern,
#insul-page-root.focus-active .corr-desc {
    color: #64748b;
}
#insul-page-root.focus-active .corr-card-atlas {
    border-color: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .corr-evidence {
    background: rgba(255,255,255,0.04);
    border-color: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .insul-corr-badge {
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
}

/* ---- Alert section: dark text ---- */
#insul-page-root.focus-active .insul-section-alerts h6 {
    color: #e2e8f0 !important;
}

/* ---- Alert table: dark ---- */
#insul-page-root.focus-active .sec-bd .table thead th {
    background: #0f172a;
    color: #94a3b8;
    border-color: #1e293b;
}
#insul-page-root.focus-active .sec-bd .table tbody td {
    background: #111827;
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.1);
}

/* ---- Chart containers: dark with blue glow ---- */
#insul-page-root.focus-active .insul-chart-container {
    background: #111827;
    border-color: rgba(14,165,233,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(14,165,233,0.08);
}

/* ---- Alert stat cards ---- */
#insul-page-root.focus-active .alert-stat {
    background: #111827;
    border-color: rgba(148,163,184,0.15);
}
#insul-page-root.focus-active .alert-stat .lbl {
    color: #64748b;
}

/* ---- Insulation transitions ---- */
#insul-page-root .insul-health-strip,
#insul-page-root .insul-metrics-viewport,
#insul-page-root .insul-metric-card,
#insul-page-root .insul-metric-value,
#insul-page-root .sec-card,
#insul-page-root .insul-chart-container,
#insul-page-root .insul-section-trends,
#insul-page-root .insul-section-correlation,
#insul-page-root .insul-section-alerts,
#insul-page-root .alert-stat,
#insul-page-root .insul-title-bar,
#insul-page-root .insul-title-bar h5,
#insul-page-root .insul-title-bar small,
#insul-page-root .sec-hd,
#insul-page-root .insul-scatter-tab,
#insul-page-root .insul-radio-group,
#insul-page-root .corr-name,
#insul-page-root .corr-evidence {
    transition: all 0.5s ease;
}
