/* ============================================================================
   IBackTested — Base Components
   Shared light-theme UI built on tokens.css. Every page consumes these.
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); line-height: 1.25; }
h1 { font-size: var(--text-3xl); font-weight: 800; }
h2 { font-size: var(--text-2xl); font-weight: 700; }
h3 { font-size: var(--text-xl); font-weight: 700; }

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

/* --------------------------------------------------------------------------
   Navbar
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0 var(--space-5);
    gap: var(--space-4);
}

.site-header .brand {
    display: flex; align-items: center; gap: 10px;
    white-space: nowrap;
}
.site-header .brand:hover { text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }

/* Lucide icon sizing helpers (icons render as <svg> with the same class) */
.ico { width: 18px; height: 18px; stroke-width: 2; }
.ico-lg { width: 22px; height: 22px; stroke-width: 2; }
.ico-sm { width: 15px; height: 15px; stroke-width: 2.2; }
.ico-xs { width: 13px; height: 13px; stroke-width: 2.4; }
.btn .ico, .btn .ico-xs, .btn .ico-sm { flex-shrink: 0; }

.main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.nav-item { position: relative; }
.nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm);
    text-decoration: none; cursor: pointer; background: none; border: none;
    font-family: var(--font-sans);
}
.nav-link:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--accent-soft); }
.nav-link .caret {
    width: 0; height: 0; border-left: 4px solid transparent;
    border-right: 4px solid transparent; border-top: 5px solid currentColor;
    opacity: 0.6;
}

.nav-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0;
    min-width: 240px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); padding: 6px;
    display: none; z-index: 110;
}
.nav-item.open .nav-dropdown { display: block; }
.nav-dropdown .dd-label {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-faint);
    padding: 8px 10px 4px;
}
.nav-dropdown a {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 600; font-size: var(--text-sm);
    text-decoration: none;
}
.nav-dropdown a:hover { background: var(--bg-inset); text-decoration: none; }
.nav-dropdown a .dd-desc {
    display: block; font-weight: 400; font-size: var(--text-xs);
    color: var(--text-muted); line-height: 1.4;
}

.nav-cta {
    background: var(--accent); color: var(--text-inverse);
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-weight: 700; font-size: var(--text-sm); text-decoration: none;
    border: none; cursor: pointer; font-family: var(--font-sans);
    white-space: nowrap;
}
.nav-cta:hover { background: var(--accent-hover); color: var(--text-inverse); text-decoration: none; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-5); }
.page { padding: var(--space-6) 0 var(--space-8); }
.page-head { margin-bottom: var(--space-5); }
.page-head .eyebrow {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 6px;
}
.page-head p.lead { color: var(--text-muted); max-width: 720px; margin-top: 8px; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}
.card-title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-2); }
.card-sub { color: var(--text-muted); font-size: var(--text-sm); }

.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Category cards on the landing page */
.cat-card {
    display: block; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: var(--space-5); color: var(--text); text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.cat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; border-color: var(--border-strong); }
.cat-card .cat-icon {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: var(--space-3);
    background: var(--accent-soft); color: var(--text);
}
.cat-card .cat-icon .ico { width: 21px; height: 21px; }
.cat-card h3 { margin-bottom: 6px; }
.cat-card p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.cat-card .cat-links { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-card .cat-links span {
    font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary);
    background: var(--bg-inset); border-radius: var(--radius-full);
    padding: 3px 10px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-weight: 700; font-size: var(--text-sm); font-family: var(--font-sans);
    cursor: pointer; text-decoration: none; border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--text-inverse); }
.btn-primary:hover { background: var(--accent-hover); color: var(--text-inverse); }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-inset); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-inset); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--text-inverse); }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn-lg { padding: 13px 28px; font-size: var(--text-base); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field label {
    display: block; font-size: var(--text-sm); font-weight: 700;
    color: var(--text-secondary); margin-bottom: 6px;
}
.field .hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.input, .select, textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: var(--text-base); font-family: var(--font-sans);
    color: var(--text); background: var(--bg);
    outline: none; transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, .select:focus, textarea:focus {
    border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="range"] { accent-color: var(--accent); width: 100%; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Option cards (wizard / selector UIs) */
.opt-card {
    display: block; border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: var(--space-4); cursor: pointer; background: var(--surface);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.opt-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.opt-card.selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text), var(--shadow-sm); }
.opt-card h4 { font-size: var(--text-base); margin-bottom: 4px; }
.opt-card p { font-size: var(--text-xs); color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Badges, pills, metrics
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: var(--text-xs); font-weight: 700;
    padding: 3px 10px; border-radius: var(--radius-full);
}
.badge-neutral { background: var(--bg-inset); color: var(--text-secondary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }

.metric-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: var(--space-4);
}
.metric-card .m-label {
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px;
}
.metric-card .m-value { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; }
.metric-card .m-value.pos { color: var(--success); }
.metric-card .m-value.neg { color: var(--danger); }
.metric-card .m-sub { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th {
    text-align: left; padding: 10px 14px; background: var(--bg-subtle);
    font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-subtle); }
table.data td.num { font-family: var(--font-mono); text-align: right; }

/* --------------------------------------------------------------------------
   Tabs & stepper
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); }
.tab {
    padding: 9px 14px; font-weight: 600; font-size: var(--text-sm);
    color: var(--text-muted); background: none; border: none; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: var(--font-sans);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }

.stepper { display: flex; align-items: center; gap: 0; margin-bottom: var(--space-6); flex-wrap: wrap; row-gap: var(--space-3); }
.step { display: flex; align-items: center; gap: 10px; }
.step .s-dot {
    width: 30px; height: 30px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-sm); font-weight: 700;
    background: var(--bg-inset); color: var(--text-muted);
    border: 1px solid var(--border);
    font-family: var(--font-sans); flex-shrink: 0;
}
.step .s-label { font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step.active .s-dot { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); }
.step.active .s-label { color: var(--text); }
.step.done .s-dot { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.step.done .s-label { color: var(--text-secondary); }
.step-line { flex: 1; min-width: 24px; height: 1px; background: var(--border); margin: 0 10px; }

/* --------------------------------------------------------------------------
   Alerts & misc
   -------------------------------------------------------------------------- */
.alert { border-radius: var(--radius-md); padding: 12px 16px; font-size: var(--text-sm); margin-bottom: var(--space-4); border: 1px solid; }
.alert-info { background: var(--info-soft); border-color: #BFDBFE; color: #1E40AF; }
.alert-success { background: var(--success-soft); border-color: #A7F3D0; color: #065F46; }
.alert-warning { background: var(--warning-soft); border-color: #FDE68A; color: #92400E; }
.alert-danger { background: var(--danger-soft); border-color: #FECACA; color: #991B1B; }

.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--border); border-top-color: var(--text);
    animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-track { height: 8px; border-radius: var(--radius-full); background: var(--bg-inset); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.3s ease; }

.divider { height: 1px; background: var(--border); border: none; margin: var(--space-5) 0; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 56px 0 36px;
    margin-top: var(--space-8);
    color: var(--text-muted);
    font-size: var(--text-sm);
}
.footer-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-5);
    display: flex;
    flex-direction: column;
    gap: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 48px;
}
@media (max-width: 960px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}
@media (max-width: 580px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}
.footer-brand-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.footer-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}
.footer-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
    max-width: 320px;
}
.footer-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--success);
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    width: fit-content;
    margin-top: 4px;
}
.footer-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}
.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.footer-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.footer-heading {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
}
.footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.footer-link {
    font-size: 0.84rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease, transform 0.15s ease;
    display: inline-block;
}
.footer-link:hover {
    color: var(--text);
    text-decoration: none;
    transform: translateX(2px);
}
.footer-disclaimer-box {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Hero (landing page)
   -------------------------------------------------------------------------- */
.hero { padding: var(--space-8) 0 var(--space-7); text-align: center; }
.hero h1 { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; max-width: 820px; margin: 0 auto var(--space-4); }
.hero h1 .accent { color: var(--link); }
.hero p.lead { font-size: var(--text-lg); color: var(--text-muted); max-width: 640px; margin: 0 auto var(--space-5); }
.hero .cta-row { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }
.hero .trust { margin-top: var(--space-5); color: var(--text-faint); font-size: var(--text-sm); }

.section-head { margin-bottom: var(--space-5); }
.section-head h2 { margin-bottom: 6px; }
.section-head p { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Mobile & Tablet Base Responsiveness (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .site-header {
        padding: 0 12px;
        height: auto;
        min-height: 52px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .site-header .brand {
        margin-right: 8px;
    }
    .main-nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .main-nav::-webkit-scrollbar {
        display: none;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .container {
        padding: 0 12px;
    }
    .card {
        padding: 16px;
    }
}

