/* ===========================================
   SCQM ORD DASHBOARD - MAIN STYLESHEET
   =========================================== */

/* ===========================================
   LOGIN MODAL
   =========================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.modal-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
    display: block;
}

.modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(65, 104, 150, 0.15);
}

.modal-error {
    font-size: 0.85rem;
    color: var(--danger-color);
    margin: 0;
}

.modal-submit {
    margin-top: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.modal-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* ---------- CSS Variables ---------- */
:root {
    --primary-color: #416896;
    --primary-dark: #6c3284;
    --secondary-color: #452438;
    --accent-color: #f093fb;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #8f1e29;
    --text-color: #333;
    --text-muted: #6c757d;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ===========================================
   LANDING PAGE
   =========================================== */

.landing-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--danger-color) 100%);
    padding: 40px 20px;
    position: relative;
}

.landing-logo {
    position: absolute;
    top: 30px;
    left: 30px;
    height: 150px;
    width: auto;
    filter: brightness(1.8) contrast(1.3);
    transition: var(--transition);
}

.landing-logo:hover {
    transform: scale(1.05);
    filter: brightness(1.7) contrast(1.3);
}

.landing-content {
    text-align: center;
    max-width: 800px;
}

.landing-title {
    font-size: 3rem;
    color: var(--white);
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.landing-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 60px;
    line-height: 1.7;
}

.enter-button {
    background: var(--white);
    color: var(--primary-color);
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.enter-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
}

/* ---------- Feature Cards ---------- */
.landing-features {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
    margin-bottom: 50px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 25px 12px;
    color: var(--white);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.feature-card .feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.feature-card h3 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.feature-card p {
    font-size: 0.78rem;
    opacity: 0.85;
    margin: 0;
    line-height: 1.4;
}

/* ===========================================
   DASHBOARD LAYOUT
   =========================================== */

.dashboard-container {
    min-height: 100vh;
    background: var(--bg-color);
}

.dashboard-header {
    background: var(--white);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.dashboard-title {
    font-size: 1.6rem;
    color: var(--text-color);
    font-weight: 600;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary-dark);
}

/* ---------- Tab Navigation ---------- */
.tab-navigation {
    display: flex;
    gap: 10px;
    padding: 20px 40px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.tab-button:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

/* ---------- Tab Content ---------- */
.tab-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-title {
    font-size: 1.9rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.tab-content > div > p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* ===========================================
   CARDS & CONTAINERS
   =========================================== */

.card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

/* ===========================================
   DATE PICKER  (dcc.DatePickerSingle)
   Restore react-dates defaults broken by the global * reset
   =========================================== */

.SingleDatePickerInput {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    padding: 0 4px !important;
    box-sizing: content-box !important;
}

.DateInput {
    width: 110px !important;
    background: transparent !important;
    box-sizing: content-box !important;
}

.DateInput_input {
    box-sizing: content-box !important;
    font-size: 14px !important;
    font-family: inherit !important;
    padding: 8px 6px !important;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    background: transparent !important;
    color: #333 !important;
    width: 100px !important;
}

.DateInput_input__focused {
    border-bottom: 2px solid #416896 !important;
}

.SingleDatePickerInput_calendarIcon {
    padding: 4px 6px !important;
    margin: 0 !important;
    box-sizing: content-box !important;
}

.SingleDatePickerInput_clearDate {
    padding: 4px !important;
    margin: 0 2px !important;
    box-sizing: content-box !important;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 992px) {
    .landing-features {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .landing-title {
        font-size: 2rem;
    }

    .landing-features {
        grid-template-columns: repeat(2, 1fr);
    }

    .tab-navigation {
        padding: 15px 20px;
    }

    .tab-content {
        padding: 20px;
    }

    .dashboard-header {
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .landing-features {
        grid-template-columns: 1fr;
    }
}

/* Colorblind mode toggle button */
.cb-btn {
    padding: 4px 14px;
    font-size: 12px;
    font-family: Segoe UI, system-ui, sans-serif;
    border: 1px solid #adb5bd;
    border-radius: 4px;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cb-btn:hover {
    background: #e9ecef;
}

.cb-btn-active {
    background: #0072B2;
    color: #ffffff;
    border-color: #0072B2;
}

.cb-btn-active:hover {
    background: #005a8e;
}

/* ===========================================
   DARK MODE TOGGLE BUTTON
   =========================================== */

.dark-mode-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-family: Segoe UI, system-ui, sans-serif;
    border: 1px solid #adb5bd;
    border-radius: 20px;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.dark-mode-btn:hover {
    background: #e9ecef;
}

.dark-mode-btn-active {
    background: #1f2937;
    color: #f3f4f6;
    border-color: #4b5563;
}

.dark-mode-btn-active:hover {
    background: #374151;
}

/* ===========================================
   DARK MODE
   =========================================== */

body.dark {
    --bg-color: #111827;
    --white: #1f2937;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.7);
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Card border in dark mode */
body.dark .card {
    border-color: var(--border-color);
}

/* Tab button hover */
body.dark .tab-button:hover {
    background: #374151;
    color: var(--text-color);
}

/* Colorblind button */
body.dark .cb-btn {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

body.dark .cb-btn:hover {
    background: #4b5563;
}

/* Modal inputs */
body.dark .modal-input {
    background-color: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}

body.dark .modal-input:focus {
    border-color: #6b9fd4;
    box-shadow: 0 0 0 3px rgba(65, 104, 150, 0.3);
}

/* Plotly charts — invert colours to approximate a dark theme */
body.dark .js-plotly-plot {
    filter: invert(1) hue-rotate(180deg);
}

/* DataTable overrides (inline styles need !important) */
body.dark .dash-spreadsheet-container .dash-spreadsheet td,
body.dark .dash-spreadsheet-container .dash-spreadsheet th {
    background-color: #1f2937 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}

body.dark .dash-spreadsheet-container .dash-spreadsheet th {
    background-color: #2d4a6e !important;
    color: #ffffff !important;
}

body.dark .dash-spreadsheet-container .dash-spreadsheet tr:last-child td {
    background-color: #162332 !important;
}

body.dark .dash-spreadsheet-container .dash-spreadsheet td.cell--selected,
body.dark .dash-spreadsheet-container .dash-spreadsheet th.cell--selected {
    background-color: #374151 !important;
}

/* ===========================================
   TAB 1 — INCLUSION CRITERIA INFO TOOLTIP
   =========================================== */

.t1-info-wrapper {
    position: relative;
    display: inline-block;
}

.t1-info-icon {
    display: none; /* HIDDEN: change to inline-flex to restore */
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #416896;
    color: #ffffff;
    font-size: 11px;
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, serif;
    cursor: help;
    user-select: none;
    flex-shrink: 0;
}

.t1-info-tooltip {
    display: none;
    position: absolute;
    top: 28px;
    left: 0;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 320px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13);
    font-size: 12.5px;
    color: #333;
    line-height: 1.6;
}

/* HIDDEN: re-enable by uncommenting
.t1-info-wrapper:hover .t1-info-tooltip {
    display: block;
}
*/

.t1-info-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.t1-info-list li {
    padding: 2px 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.t1-info-warn {
    color: #b45309;
}

/* Dark mode adjustments */
body.dark .t1-info-icon {
    background: #4a7ab5;
}

body.dark .t1-info-tooltip {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

body.dark .t1-info-warn {
    color: #fbbf24;
}

/* ===========================================
   DARK MODE — GENERAL FIXES
   =========================================== */

/* Active tab: force white text (--white resolves to dark in dark mode) */
body.dark .tab-button.active {
    color: #ffffff !important;
}

/* Tab intro description boxes */
body.dark .tab-intro {
    background-color: #1e2d3d !important;
    color: #d1d5db !important;
    border-left-color: #6b9fd4 !important;
}

/* Filter / result cards with inline background: #fff */
body.dark .filter-card {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

/* Dash 4.0 design tokens — override for dark mode */
body.dark {
    --Dash-Fill-Inverse-Strong: #1f2937;
    --Dash-Stroke-Strong: #4b5563;
    --Dash-Text-Strong: #f3f4f6;
    --Dash-Text-Weak: #9ca3af;
    --Dash-Text-Disabled: #6b7280;
    --Dash-Fill-Disabled: #374151;
    --Dash-Fill-Interactive-Weak: #2d4a6e;
    --Dash-Shading-Strong: rgba(0, 0, 0, 0.5);
    --Dash-Shading-Weak: rgba(0, 0, 0, 0.3);
}

/* Dash 4 dropdown explicit overrides */
body.dark .dash-dropdown,
body.dark .dash-dropdown-content {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

body.dark .dash-dropdown-search-container {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
}

body.dark .dash-dropdown-search {
    background: transparent !important;
    color: #f3f4f6 !important;
}

body.dark .dash-dropdown-placeholder {
    color: #6b7280 !important;
}

/* DataTable even-row stripe override */
body.dark .dash-spreadsheet-container .dash-spreadsheet tr:nth-child(even) td {
    background-color: #243447 !important;
}

body.dark .dash-spreadsheet-container .dash-spreadsheet tr:nth-child(odd) td {
    background-color: #1f2937 !important;
}

/* DataTable hover tooltip (duration stats) */
.dash-table-tooltip {
    font-size: 13px !important;
    padding: 10px 14px !important;
    border-radius: 6px !important;
    border: 1px solid #d1d9e6 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) !important;
    background: #fff !important;
    max-width: 220px !important;
}

.dash-table-tooltip p {
    margin: 0 0 8px 0 !important;
    font-weight: 600 !important;
    color: #416896 !important;
}

.dash-table-tooltip table {
    border-collapse: collapse !important;
    width: 100% !important;
}

.dash-table-tooltip td {
    padding: 3px 8px !important;
    border-bottom: 1px solid #eef0f4 !important;
    color: #333 !important;
}

.dash-table-tooltip tr:last-child td {
    border-bottom: none !important;
}

.dash-table-tooltip td:last-child {
    text-align: right !important;
    font-variant-numeric: tabular-nums !important;
    font-weight: 600 !important;
    color: #416896 !important;
}
