/* ===========================================
   Test of Time - Custom Styles
   Light theme default, inspired by the-test-of-time.com
   =========================================== */

/* ===== Light Theme (default) ===== */
:root {
    --tot-primary: #003399;          /* Dark powder blue */
    --tot-primary-hover: #002266;    /* Deeper powder blue on hover */
    --tot-accent: #334155;           /* Slate 700 — secondary accent */
    --tot-accent-secondary: #64748b; /* Slate 500 */
    --tot-danger: #dc2626;
    --tot-bg: #f1f2f4;               /* Cool grey */
    --tot-bg-secondary: #e5e7eb;     /* Grey 200 — deliberate, serious */
    --tot-bg-card: #f8f9fa;          /* Barely-there warm white */
    --tot-bg-navbar: #f8f9fa;
    --tot-text-primary: #111827;     /* Near-black */
    --tot-text-secondary: #4b5563;   /* Grey 600 — readable, not faded */
    --tot-border: #d1d5db;           /* Grey 300 */
    --tot-shadow: rgba(0, 0, 0, 0.05);
    --tot-gradient: linear-gradient(135deg, #002266 0%, #003399 100%);
}

/* ===== Dark Theme (toggle) — black-tie with icy blue accent ===== */
[data-theme="dark"] {
    --tot-primary: #7FB3DE;          /* Light powder blue — cold, precise */
    --tot-primary-hover: #99C4E8;
    --tot-accent: #4A8ABF;           /* Powder blue mid */
    --tot-accent-secondary: #5a6a7e;
    --tot-danger: #c0392b;
    --tot-bg: #1a1a1e;               /* Dark charcoal */
    --tot-bg-secondary: #222226;     /* Slightly lifted charcoal */
    --tot-bg-card: #2a2a2e;          /* Card: visible lift */
    --tot-bg-navbar: #1a1a1e;        /* Seamless with bg */
    --tot-text-primary: #d4d4d8;     /* Zinc 300 — cool, not warm white */
    --tot-text-secondary: #71717a;   /* Zinc 500 — deliberately restrained */
    --tot-border: #27272a;           /* Zinc 800 — hairline, barely there */
    --tot-shadow: rgba(0, 0, 0, 0.6);
    --tot-gradient: linear-gradient(135deg, #4A8ABF 0%, #7FB3DE 100%);
}

/* ===== Base Styles ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--tot-bg-secondary);
    color: var(--tot-text-primary);
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--tot-text-primary);
}

h1 { font-size: 2.25rem; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.4rem; }

/* ===== Navbar — clean, minimal, ToT-style ===== */
.navbar {
    background-color: var(--tot-bg-navbar) !important;
    border-bottom: 1px solid var(--tot-border);
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 3px var(--tot-shadow);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--tot-primary) !important;
    -webkit-text-fill-color: var(--tot-primary);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

.navbar-brand:hover {
    color: var(--tot-primary-hover) !important;
    -webkit-text-fill-color: var(--tot-primary-hover);
}

.navbar-nav .nav-link {
    color: var(--tot-text-secondary) !important;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    padding: 0.5rem 0.85rem !important;
    border-radius: 0.375rem;
    transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--tot-primary) !important;
    background-color: transparent;
}

.navbar-nav .nav-link.active {
    color: var(--tot-primary) !important;
}

.dropdown-menu {
    background-color: var(--tot-bg-card);
    border: 1px solid var(--tot-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px var(--tot-shadow);
    margin-top: 0.25rem;
}

.dropdown-item {
    color: var(--tot-text-primary);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.dropdown-item:hover {
    background-color: var(--tot-bg-secondary);
    color: var(--tot-primary);
}

.dropdown-header {
    color: var(--tot-text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.navbar-toggler {
    border-color: var(--tot-border);
}

/* ===== Cards ===== */
.card {
    background-color: var(--tot-bg-card);
    border: 1px solid #111827;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px var(--tot-shadow);
}

[data-theme="dark"] .card {
    border-color: #3f3f46;           /* Zinc 700 — surgical, not loud */
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--tot-border);
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn-primary {
    background: var(--tot-gradient);
    border: none;
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 51, 153, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 51, 153, 0.35);
    background: var(--tot-gradient);
}

.btn-secondary {
    background-color: var(--tot-bg-secondary);
    border: 1px solid var(--tot-border);
    color: var(--tot-text-primary);
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
}

.btn-secondary:hover {
    background-color: var(--tot-border);
    border-color: var(--tot-border);
}

/* ===== Forms ===== */
.form-control {
    background-color: var(--tot-bg-card);
    border: 1px solid var(--tot-border);
    color: var(--tot-text-primary);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    background-color: var(--tot-bg-card);
    border-color: var(--tot-primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.15);
    color: var(--tot-text-primary);
}

.form-control::placeholder {
    color: var(--tot-text-secondary);
}

.form-select {
    background-color: var(--tot-bg-secondary);
    border: 1px solid var(--tot-border);
    color: var(--tot-text-primary);
    border-radius: 0.5rem;
    padding: 0.55rem 2.25rem 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.85em 0.85em;
}

.form-select:hover {
    border-color: var(--tot-primary);
}

.form-select:focus {
    border-color: var(--tot-primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.15);
    outline: none;
}

[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-label {
    font-weight: 500;
    color: var(--tot-text-secondary);
    margin-bottom: 0.5rem;
}

/* ===== Tables ===== */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--tot-bg-secondary);
    --bs-table-hover-bg: var(--tot-bg-secondary);
    border-color: var(--tot-border);
}

.table thead th {
    background-color: var(--tot-bg-secondary);
    border-bottom: 2px solid var(--tot-border);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--tot-text-secondary);
    padding: 1rem 0.75rem;
}

.table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-color: var(--tot-border);
}

/* ===== Alerts ===== */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

[data-theme="dark"] .alert-warning { color: var(--tot-accent-secondary); }
[data-theme="dark"] .alert-success { color: var(--tot-accent); }
[data-theme="dark"] .alert-danger { color: var(--tot-danger); }

/* ===== Footer ===== */
footer {
    background-color: var(--tot-bg-navbar);
    border-top: 1px solid var(--tot-border);
}

/* ===== Hero Section ===== */
.hero-section {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    max-height: 280px;
}

.hero-section img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    object-position: center 60%;
    display: block;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* ===== Project Cards (Home) ===== */
.project-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--tot-shadow);
}

.project-card .card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--tot-primary);
}

.project-card h5 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.project-card h6 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tot-primary);
    margin-bottom: 0.5rem;
}

/* ===== Team Cards (About) ===== */
.team-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--tot-shadow);
}

.team-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.team-affiliation {
    font-size: 0.85rem;
    color: var(--tot-text-secondary);
}

/* ===== Paper Links ===== */
.paper-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--tot-border);
    border-radius: 0.5rem;
    color: var(--tot-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.paper-link:hover {
    background: rgba(0, 51, 153, 0.08);
    color: var(--tot-primary);
    border-color: var(--tot-primary);
}

/* ===== Controls Card (Filters) ===== */
.controls-card {
    background: var(--tot-bg-card);
    border: 1px solid var(--tot-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px var(--tot-shadow);
}

.controls-card label,
.filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--tot-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
    display: block;
}

/* ===== Segmented Control (Pill Toggles) ===== */
.seg-control {
    display: inline-flex;
    background: var(--tot-bg-secondary);
    border: 1px solid var(--tot-border);
    border-radius: 0.5rem;
    padding: 3px;
    gap: 2px;
}

.seg-control .seg-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--tot-text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.seg-control .seg-btn:hover {
    color: var(--tot-text-primary);
    background: var(--tot-bg-card);
}

.seg-control .seg-btn.active {
    background: var(--tot-primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .seg-control .seg-btn.active {
    background: var(--tot-primary);
    color: #0a0a0a;
}

/* ===== Nav Tabs ===== */
.nav-tabs {
    border-bottom: 2px solid var(--tot-border);
}

.nav-tabs .nav-link {
    border: none !important;
    border-bottom: 2px solid transparent !important;
    margin-bottom: -2px;
    color: var(--tot-text-secondary) !important;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--tot-text-secondary) !important;
    color: var(--tot-text-primary) !important;
    background: transparent !important;
}

.nav-tabs .nav-link.active {
    background: transparent !important;
    border-bottom: 2px solid var(--tot-primary) !important;
    color: var(--tot-primary) !important;
}

/* ===== Theme Toggle Button ===== */
#theme-toggle {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-color: var(--tot-border);
    color: var(--tot-text-secondary);
    background: transparent;
}

#theme-toggle:hover {
    color: var(--tot-primary);
    border-color: var(--tot-primary);
}

/* ===== Utility Classes ===== */
.text-gradient {
    background: var(--tot-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-muted-custom {
    color: var(--tot-text-secondary) !important;
}

/* ===== Plotly Chart Responsiveness ===== */
.js-plotly-plot,
.plotly {
    max-width: 100%;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .navbar { padding: 0.5rem 0.75rem; }
    .navbar-brand { font-size: 1.2rem; }

    .table { font-size: 0.8rem; }
    .table thead th { padding: 0.625rem 0.5rem; font-size: 0.7rem; }
    .table tbody td { padding: 0.625rem 0.5rem; }

    .card-body { padding: 1rem; }
    .btn { padding: 0.5rem 1rem; }
}

@media (max-width: 576px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .table { font-size: 0.75rem; }
    .card-body { padding: 0.75rem; }

    .form-select, .form-control { font-size: 0.875rem; }
}
