/* Cancer Transcriptomics ML — Modern Scientific Theme
   ─────────────────────────────────────────────────── */

/* ── Google Fonts import ────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
    --sci-bg:      #f5f6fa;
    --sci-surface:  #ffffff;
    --sci-text:     #1e293b;
    --sci-muted:    #64748b;
    --sci-border:   #e2e8f0;
    --sci-primary:  #3b82f6;
    --sci-success:  #10b981;
    --sci-warning:  #f59e0b;
    --sci-danger:   #ef4444;
    --sci-accent:   #6366f1;
    --sci-accent2:  #8b5cf6;
    --sci-shadow:   0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --sci-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --sci-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --sci-radius:   12px;
    --sci-radius-sm: 8px;
}

/* ── Typography ─────────────────────────────────────────────── */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--sci-text);
    background: var(--sci-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
    color: var(--sci-text);
    font-weight: 700;
    letter-spacing: -0.02em;
}
h2 { font-size: 1.6rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
.text-muted { color: var(--sci-muted) !important; }
.lead { font-weight: 400; color: var(--sci-muted); }

/* Monospace for numbers/metrics */
.metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    letter-spacing: -0.03em;
}

/* ── Page transitions ───────────────────────────────────────── */
#page-content > *, ._pages_content > * {
    animation: pageFadeIn 0.35s ease-out;
}
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    padding: 0.5rem 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.navbar-brand {
    font-weight: 700 !important;
    font-size: 1rem !important;
    letter-spacing: -0.02em;
}
.navbar .nav-link {
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem !important;
    border-radius: var(--sci-radius-sm);
    transition: all 0.2s ease;
    color: rgba(255,255,255,0.75) !important;
    letter-spacing: 0.01em;
}
.navbar .nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,1) !important;
}
.navbar .nav-link.active {
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    border-radius: var(--sci-radius);
    border: 1px solid var(--sci-border);
    background: var(--sci-surface);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card.shadow-sm {
    box-shadow: var(--sci-shadow) !important;
    border-color: transparent;
}
.card.shadow-sm:hover {
    box-shadow: var(--sci-shadow-md) !important;
}
.card-body { padding: 1.25rem; }

/* Stat cards — hero numbers */
.stat-card {
    border: 1px solid var(--sci-border) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sci-shadow-lg) !important;
    border-color: var(--sci-primary) !important;
}
.stat-card .card-body h3 {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.5rem;
}

/* Gradient accent top-line for key cards */
.accent-card {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--sci-primary), var(--sci-accent)) 1;
}
.accent-card-success {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--sci-success), #059669) 1;
}
.accent-card-warning {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--sci-warning), #d97706) 1;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table {
    font-size: 0.85rem;
    --bs-table-bg: transparent;
}
.table th {
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sci-muted);
    border-bottom: 2px solid var(--sci-border);
    padding: 0.6rem 0.75rem;
}
.table td {
    vertical-align: middle;
    padding: 0.55rem 0.75rem;
    border-color: #f1f5f9;
}
.table tbody tr:hover {
    background: #f8fafc;
}
.table-light th {
    background: #f8fafc;
}

/* Dash DataTable overrides */
.dash-table-container .dash-spreadsheet-container {
    border-radius: var(--sci-radius-sm) !important;
    overflow: hidden;
}
.dash-table-container .dash-header {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    font-size: 0.65rem;
    font-weight: 600;
    vertical-align: middle;
    padding: 0.3em 0.6em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* ── Plotly charts ──────────────────────────────────────────── */
.js-plotly-plot {
    border-radius: var(--sci-radius-sm);
}
.js-plotly-plot .plotly .modebar {
    top: 6px !important;
    right: 6px !important;
}
.js-plotly-plot .plotly .modebar-btn {
    font-size: 13px !important;
    opacity: 0.4;
}
.js-plotly-plot .plotly .modebar-btn:hover {
    opacity: 0.9;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    border-radius: var(--sci-radius-sm);
    font-size: 0.85rem;
    border: none;
    padding: 0.85rem 1.1rem;
}
.alert-light {
    background: #f8fafc;
    border: 1px solid var(--sci-border) !important;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    border-radius: var(--sci-radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.4rem 1rem;
    transition: all 0.2s ease;
}
.btn-outline-primary {
    border-color: var(--sci-primary);
    color: var(--sci-primary);
}
.btn-outline-primary:hover {
    background: var(--sci-primary);
    border-color: var(--sci-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.25);
}
.btn-outline-success {
    border-color: var(--sci-success);
    color: var(--sci-success);
}
.btn-outline-success:hover {
    background: var(--sci-success);
    border-color: var(--sci-success);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

/* ── Accordion ──────────────────────────────────────────────── */
.accordion-item {
    border: 1px solid var(--sci-border);
    border-radius: var(--sci-radius-sm) !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.accordion-button {
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.85rem 1.1rem;
    background: #fafbfc;
}
.accordion-button:not(.collapsed) {
    background: #f0f4ff;
    color: var(--sci-primary);
}
.accordion-body {
    font-size: 0.88rem;
    line-height: 1.75;
}

/* ── Progress bars ──────────────────────────────────────────── */
.progress {
    border-radius: 6px;
    background: #e2e8f0;
    height: 6px;
    overflow: hidden;
}
.progress-bar {
    border-radius: 6px;
}

/* ── Dropdown ───────────────────────────────────────────────── */
.Select-control, .dash-dropdown .Select-control {
    border-radius: var(--sci-radius-sm) !important;
    border-color: var(--sci-border) !important;
}
.Select-control:hover {
    border-color: var(--sci-primary) !important;
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
    font-size: 0.78rem;
    background: #fafbfc !important;
    border-top: 1px solid var(--sci-border) !important;
}

/* ── Spacing utilities ──────────────────────────────────────── */
.section-divider {
    border: 0;
    border-top: 1px solid var(--sci-border);
    margin: 2.5rem 0;
}

/* ── Hero section ───────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--sci-radius);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(99,102,241,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.hero-section h1 {
    color: white;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.hero-section .lead {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
}
.hero-subtitle {
    display: inline-block;
    background: linear-gradient(90deg, var(--sci-primary), var(--sci-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem;
}

/* ── Cross-page navigation cards ───────────────────────────── */
.nav-card {
    border: 1px solid var(--sci-border);
    transition: all 0.25s ease;
    cursor: pointer;
}
.nav-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sci-shadow-lg) !important;
    border-color: var(--sci-primary);
}

/* ── Section headers with accent bar ────────────────────────── */
.section-header {
    position: relative;
    padding-left: 1rem;
}
.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--sci-primary), var(--sci-accent));
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-section { padding: 1.5rem 1rem; }
    .hero-section h1 { font-size: 1.6rem; }
    .lead { font-size: 0.9rem; }
    .js-plotly-plot { min-height: 260px; }
    .card { margin-bottom: 0.75rem; }
    .stat-card .card-body h3 { font-size: 1.2rem; }
}
@media (min-width: 1400px) {
    .container-fluid { max-width: 1320px; }
}
