/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── Global Reset ────────────────────────────────────────── */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    margin: 0;
    padding: 0;
    background: #f2f4f8;
}

/* ── Scrollbar Styling ───────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(107, 117, 144, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 117, 144, 0.5);
}

/* ── Dash Tab Overrides ──────────────────────────────────── */
.custom-tabs .tab {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    transition: color 0.15s ease, border-color 0.15s ease;
}

/* ── Input Styling ───────────────────────────────────────── */
input[type="number"] {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    transition: border-color 0.15s ease;
}
input[type="number"]:focus {
    border-color: #4a90d9 !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

/* ── Dropdown Overrides ──────────────────────────────────── */
.Select-control, .Select-menu-outer, .Select-option {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.Select-control {
    border-radius: 6px !important;
    transition: border-color 0.15s ease !important;
}
.Select-control:hover {
    border-color: #4a90d9 !important;
}

/* ── Button Hover States ─────────────────────────────────── */
button {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
button:hover {
    filter: brightness(1.12);
}
button:active {
    transform: scale(0.98);
}

/* ── Slider Overrides ────────────────────────────────────── */
.rc-slider-mark-text {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* ── DataTable Overrides ─────────────────────────────────── */
.dash-table-container .dash-spreadsheet-container {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    border-radius: 6px;
    overflow: hidden;
}

/* ── Chart polish ────────────────────────────────────────── */
.js-plotly-plot {
    border-radius: 8px;
}

/* ── Details/Summary Toggle ──────────────────────────────── */
details summary {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    transition: color 0.15s ease;
}
details summary:hover {
    color: #4a90d9 !important;
}
details[open] summary {
    color: #4a5060 !important;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .dash-graph {
        min-width: 0 !important;
    }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Stack sidebar above main content */
    #app-body {
        flex-direction: column !important;
    }

    /* Sidebar: full width, compact, scrollable */
    #app-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        max-height: 200px !important;
        overflow-y: auto !important;
        padding: 12px 16px !important;
        border-right: none !important;
        border-bottom: 1px solid #252840 !important;
    }

    /* Par rate inputs: horizontal grid */
    #par-inputs-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px 8px !important;
    }
    #par-inputs-grid > div {
        margin-bottom: 0 !important;
    }

    /* Main content: no overflow hidden */
    #app-body > div:last-child {
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    /* Tabs: scrollable, compact */
    .custom-tabs {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .custom-tabs .tab {
        padding: 9px 12px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    /* Tab description */
    #tab-header {
        padding: 8px 14px !important;
    }

    /* Metric strips: horizontal scroll */
    #dur-metrics-strip,
    #rd-metrics-strip,
    #pricer-metrics-strip,
    #ps-summary-strip,
    #yc-summary-strip {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px !important;
    }

    /* Side-by-side chart divs: stack vertically */
    div[style*="display: flex"][style*="gap: 16px"] {
        flex-direction: column !important;
    }

    /* Data tables: horizontal scroll */
    .dash-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Header compact */
    #app-header {
        min-height: 40px !important;
        padding: 8px 16px !important;
        flex-wrap: wrap;
    }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (≤ 480px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    #app-sidebar {
        max-height: 160px !important;
        padding: 10px 12px !important;
    }

    .custom-tabs .tab {
        padding: 8px 8px !important;
        font-size: 10px !important;
    }

    /* On phones, hide subtitle span and divider — keep brand link visible */
    #app-header span:last-of-type {
        display: none !important;
    }
    #app-header > div {
        display: none !important;
    }

    #tab-header {
        font-size: 10px !important;
        padding: 6px 10px !important;
    }
}
