/* ═══════════════════════════════════════════════════════════════════════
   Phase Equilibrium EOS — Styles
   ═══════════════════════════════════════════════════════════════════════ */

/* Define global CSS variables for colors, shadows, and typography */
:root {
    --bg-color: #f0f2f5;
    --bg-surface: #ffffff;
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    --panel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --purple: #6366f1;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Global reset for box-sizing, margins, and padding */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom scrollbar styling for the html element */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* Base body styles including background, typography, and default text color */
body {
    font-family: var(--font-main);
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Hidden pseudo-element for layout adjustments if needed */
body::before {
    display: none;
}

/* Main wrapper for the entire application layout */
.app-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 16px 20px;
    position: relative;
    z-index: 1;
}

/* ═══ HEADER ═══ */
/* Styling for the application header containing logo and global controls */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--panel-border);
    box-shadow: var(--panel-shadow);
    margin-bottom: 0;
}

/* Logo section within the header */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main application title styling */
.logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

/* Logo icon color */
/* Logo icon color */
.logo svg {
    color: #60a5fa;
}

/* --- Responsive Header --- */
@media (max-width: 640px) {
    .header {
        padding: 12px 16px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .logo h1 {
        font-size: 1.1rem;
    }
    .expert-mode-btn {
        display: none; /* Hide expert mode on mobile to save space */
    }
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Container for the unit switching toggle */
.unit-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

/* Individual button within the unit toggle */
.unit-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

/* Active state for the selected unit button */
.unit-btn.active {
    background: var(--primary);
    color: white;
}

/* Toggle button for advanced/expert configuration mode */
.expert-mode-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    background: #f8fafc;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

/* Hover effect for the expert mode button */
.expert-mode-btn:hover {
    background: #e2e8f0;
}

/* ═══ TAB BAR ═══ */
/* Horizontal bar containing navigation tabs */
.tab-bar {
    display: flex;
    gap: 0;
    padding: 0 8px;
    margin-top: 10px;
    margin-bottom: 16px;
}

/* Button for switching between application tabs */
.tab-btn {
    padding: 10px 22px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hover state for tab buttons */
.tab-btn:hover {
    color: var(--text-primary);
}

/* Active state for the currently selected tab */
/* Active state for the currently selected tab */
.tab-btn.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
    font-weight: 600;
}

/* --- Responsive Tab Bar --- */
@media (max-width: 640px) {
    .tab-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding: 0;
        margin-bottom: 20px;
        background: #f8fafc;
        border-radius: 8px;
        overflow: hidden;
    }

    .tab-btn {
        padding: 12px 6px;
        font-size: 0.75rem;
        flex-direction: column;
        border-bottom: 3px solid transparent;
        text-align: center;
        gap: 4px;
    }
    
    .tab-icon {
        font-size: 1rem;
    }
}

/* Optional icon within a tab button */
.tab-icon {
    font-size: 0.9rem;
}

/* ═══ TAB CONTENT ═══ */
/* Base container for content within a single tab */
.tab-content {
    display: none;
}

/* Visibility state for the active tab content with entrance animation */
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ DASHBOARD (3-column PVT layout) ═══ */
/* Main grid layout for the PVT dashboard (3-column) */
/* Main grid layout for the PVT dashboard (3-column) */
.dashboard {
    display: grid;
    grid-template-columns: 320px 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* --- Responsive Dashboard --- */
@media (max-width: 1100px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard {
        gap: 12px;
    }
    .panel {
        padding: 16px;
    }
}

/* ═══ PANELS ═══ */
/* Generic style for dashboard segments */
.panel {
    padding: 20px;
    border-radius: 14px;
}

/* Glassmorphism/Surface effect for panels including border and shadow */
.glass {
    background: var(--bg-surface);
    border: 1px solid var(--panel-border);
    box-shadow: var(--panel-shadow);
}

/* Header styling for major panels within the dashboard */
.panel h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* ═══ INPUT PANEL ═══ */
/* Sidebar input panel with restricted height and scrolling for long forms */
.input-panel {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* Vertical arrangement for a label and its corresponding input */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

/* Horizontal grid for placing two form components side-by-side */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 6px;
}

.form-group label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Standardized modern look for all text and number input fields */
.input-modern {
    background: #ffffff;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

/* Focused state for modern inputs with a primary color outline */
.input-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.compact .input-modern {
    padding: 6px 10px;
    font-size: 0.82rem;
}

.input-sm {
    width: 70px !important;
}

/* ═══ COMPOSITION AREA ═══ */
.composition-area {
    margin-bottom: 12px;
}

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

.comp-header h3 {
    font-size: 0.88rem;
    font-weight: 600;
}

/* Decorative display for the mole fraction sum in the composition header */
.mole-sum {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-weight: 700;
}

/* Warning state for the mole sum when it doesn't add up correctly */
.mole-sum.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.comp-table-header {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.comp-col-label {
    flex: 1;
}

.comp-col-label:last-child {
    text-align: right;
    max-width: 70px;
}

/* Scrollable container for the mixture components list */
.table-container {
    max-height: 220px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

.table-container::-webkit-scrollbar {
    width: 5px;
}

.table-container::-webkit-scrollbar-track {
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#comp-table {
    width: 100%;
    border-collapse: collapse;
}

#comp-table td {
    padding: 6px 8px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--panel-border);
}

#comp-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

#comp-table td:last-child {
    text-align: right;
}

.z-input {
    width: 90px;
    background: #ffffff;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    text-align: center;
    font-family: 'Inter', monospace;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Hide default browser number spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.z-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #f8fafc;
}

/* ═══ COMP ACTIONS ═══ */
/* Container for secondary actions related to composition (e.g., defaults, normalize) */
.comp-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 8px;
}

/* ═══ BUTTONS ═══ */
/* Base class for all buttons to ensure consistent alignment and typography */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-main);
}

/* Small variation for compact buttons */
.btn-sm {
    padding: 8px 14px;
    font-size: 0.78rem;
}

/* Full-width variation for buttons in sidebars or lists */
.btn-full {
    width: 100%;
}

/* Styles for non-critical fallback actions */
.btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
}

/* Hover state for secondary buttons */
.btn-secondary:hover {
    background: #e2e8f0;
}

/* Primary call-to-action button styling with gradient and subtle shadow */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

/* Lift effect on hover for primary buttons */
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Destructive action button (like clearing data) with subtle warning cues */
.btn-danger-outline {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Hover state for danger buttons */
.btn-danger-outline:hover {
    background: #fee2e2;
}

/* ═══ CALCULATION BUTTONS (Analysis Tools) ═══ */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* High-emphasis buttons for core calculation triggers */
.btn-calc {
    width: 100%;
    padding: 14px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    text-align: center;
    letter-spacing: 0.2px;
    border: none;
    color: white;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.btn-calc:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.btn-compressibility {
    background: var(--primary);
}

.btn-density {
    background: var(--info);
}

.btn-ki {
    background: var(--purple);
}

.btn-bubble {
    background: var(--success);
}

.btn-dew {
    background: var(--warning);
}

.btn-flash {
    background: #0f766e;
    /* Teal */
}

/* ═══ MIXTURE INFO BOX ═══ */
/* Box for displaying derived mixture properties like Molecular Weight */
.mixture-info-box {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
}

/* Label for mixture information boxes */
.mixture-info-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* Value display for mixture information boxes */
.mixture-info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Typography for measurement units in mixture info */
.mw-unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* ═══ RESULTS PANEL ═══ */
.results-panel h2 {
    margin-bottom: 14px;
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-box {
    padding: 14px 16px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--panel-border);
}

.result-box.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
    padding: 24px;
}

/* Label for a specific result value */
.res-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* Large value display for calculation results with monospace numbers */
.res-value {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Inter', monospace;
    letter-spacing: -0.5px;
}

.res-unit {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-left: 6px;
}

.box-blue .res-value {
    color: #60a5fa;
}

.box-green .res-value {
    color: #34d399;
}

.box-orange .res-value {
    color: #fb923c;
}

.box-purple .res-value {
    color: #a78bfa;
}

.phase-banner {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ═══ PHASE TABLE ═══ */
.phase-table-container {
    max-height: 280px;
}

#results-table {
    width: 100%;
    border-collapse: collapse;
}

/* Table header column labels for phase results */
#results-table thead th {
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
    border-bottom: 1px solid var(--panel-border);
    text-align: right;
}

/* Ensure the first column (component name) is left-aligned */
#results-table thead th:first-child {
    text-align: left;
}

#results-table td {
    padding: 7px 10px;
    font-size: 0.82rem;
    font-family: 'Inter', monospace;
    border-bottom: 1px solid var(--panel-border);
    text-align: right;
}

#results-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

/* ═══ COMPARISON SUITE (TAB 2) ═══ */
.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Typography for comparison tab subtitles with icon alignment */
.comparison-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-actions {
    display: flex;
    gap: 10px;
}

.btn-recalculate {
    background: var(--primary);
    color: white;
    padding: 8px 18px;
    font-size: 0.85rem;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
}

.btn-recalculate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.3);
}

/* Secondary controls bar for setting ranges and modes in Comparison tab */
.comparison-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    margin-bottom: 16px;
}

.comparison-controls label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.range-separator {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Grid layout for displaying multiple charts side-by-side in comparison */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--panel-border);
    box-shadow: var(--panel-shadow);
    border-radius: 12px;
    padding: 16px;
}

.chart-header-row {
    position: relative;
    text-align: center;
    margin-bottom: 10px;
}

.chart-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.download-chart-btn {
    position: absolute;
    right: 0;
    top: -4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.download-chart-btn:hover {
    color: var(--primary);
    background: #f1f5f9;
}

/* Relative wrapper to hold Chart.js canvas elements with fixed heights */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-legend {
    display: flex;
    gap: 22px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.comparison-slider {
    padding: 8px 16px;
}

.styled-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: 3px;
    outline: none;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f59e0b;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.styled-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f59e0b;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* ═══ DATA & EXPORT (TAB 3) ═══ */
.data-management-section {
    padding: 20px 0;
}

.data-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

/* Layout for information cards in the data management section */
.data-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.data-card {
    background: var(--bg-surface);
    border: 1px solid var(--panel-border);
    box-shadow: var(--panel-shadow);
    border-radius: 14px;
    padding: 24px;
}

.data-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.data-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 18px;
}

/* ═══ UTILITIES ═══ */
.mt-4 {
    margin-top: 20px;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
}

/* ═══ RESPONSIVE ═══ */
/* Responsive adjustments for phones and tablets */
@media (max-width: 1100px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .data-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
    }

    .comparison-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px;
    }
    
    .chart-container {
        height: 240px;
    }

    /* Phase Envelope specific responsive fixes */
    .pe-layout-grid {
        grid-template-columns: 1fr !important;
    }
    
    .pe-settings-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .pe-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .pe-full-explanation {
        padding: 16px !important;
    }
    
    .pe-full-explanation div {
        grid-template-columns: 1fr !important;
    }
}

/* ═══ CHART EXPLANATION PANEL ═══ */
/* Slide-out panel for educational content and deep-dive chart analysis */
.chart-explanation-panel {
    position: fixed;
    top: 50%;
    left: -450px; /* Hidden by default on the LEFT */
    transform: translateY(-50%);
    width: 420px;
    height: 85vh;
    max-height: 85vh;
    z-index: 1000;
    padding: 0;
    transition: left 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border-radius: 0 20px 20px 0;
    border: 1px solid var(--panel-border);
    border-left: none;
    background: rgba(255, 255, 255, 0.98);
}

.chart-explanation-panel.active {
    left: 0;
}

.chart-explanation-panel.right {
    left: auto;
    right: -450px;
    border-radius: 20px 0 0 20px;
    border-left: 1px solid var(--panel-border);
    border-right: none;
    transition: right 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.15);
}

.chart-explanation-panel.right.active {
    right: 0;
    left: auto;
}

.explanation-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.explanation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--panel-border);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.explanation-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #f1f5f9;
}

/* Scrollbar styling specifically for the slide-out explanation body */
.explanation-body::-webkit-scrollbar {
    width: 6px;
}

.explanation-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.explanation-body::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.explain-chart-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.explain-chart-btn:hover {
    color: var(--primary);
    background: #f0f9ff;
    transform: scale(1.1);
}

.explanation-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.close-btn {
    background: #f1f5f9;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Animations for closing the panel button */
.close-btn:hover {
    background: #e2e8f0;
    color: var(--danger);
    transform: rotate(90deg);
}

.explanation-section {
    margin-bottom: 24px;
}

.explanation-section h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.explanation-section ul {
    list-style: none;
}

.explanation-section li {
    font-size: 0.88rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
}

.explanation-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 800;
}

.eos-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual small card for specific EOS variant descriptions */
.eos-mini-card {
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-left: 5px solid #ccc;
    transition: transform 0.2s ease;
}

/* Hover lift effect for EOS description cards */
.eos-mini-card:hover {
    transform: translateX(5px);
    background: #ffffff;
}

/* Styling for sub-topic titles in explanation cards */
.eos-mini-card strong {
    font-size: 0.85rem;
    display: block;
    margin-bottom: 4px;
}

/* Base text for description cards */
.eos-mini-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Variant-specific border colors for the mini profile cards */
.eos-mini-card.pr {
    border-left-color: #2563eb;
}

.eos-mini-card.srk {
    border-left-color: #059669;
}

.eos-mini-card.rk {
    border-left-color: #d97706;
}

.eos-mini-card.vdw {
    border-left-color: #dc2626;
}

.explanation-insight {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    padding: 18px;
    border-radius: 14px;
}

.explanation-insight h4 {
    color: var(--primary);
    margin-bottom: 8px;
}

.explanation-insight p {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0369a1;
    line-height: 1.6;
}

/* Container for the educational FAQ list in the slide-out panel */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Individual FAQ entry with question and answer */
.faq-item {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

/* Remove border from the last FAQ item */
.faq-item:last-child {
    border-bottom: none;
}

/* Bold styling for the FAQ question */
.faq-item strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Paragraph styling for the FAQ answer */
.faq-item p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}