/* ── Google Fonts loaded in layout.php ───────────────────────────────────────
   Bebas Neue     → headers, labels, nav
   IBM Plex Mono  → data, stats, mono text
   ──────────────────────────────────────────────────────────────────────────── */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */
:root {
    --bg:           #080808;
    --bg2:          #111111;
    --bg3:          #1a1a1a;
    --surface:      #141414;
    --border:       #242424;
    --border-light: #2e2e2e;

    --red:          #cc1111;
    --red-dim:      #7a0a0a;
    --red-glow:     rgba(204,17,17,0.15);

    --text:         #e8e8e8;
    --text-dim:     #666666;
    --text-muted:   #444444;

    --ff-display: 'Bebas Neue', Impact, sans-serif;
    --ff-mono:    'IBM Plex Mono', 'Courier New', monospace;

    --radius:   2px;
    --gap:      1.5rem;
    --nav-h:    58px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--ff-mono);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ── Scanline overlay ─────────────────────────────────────────────────────── */
.scanlines {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.07) 2px,
        rgba(0,0,0,0.07) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--gap);
    padding: 0 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-icon { font-size: 1.2rem; color: var(--red); }
.brand-text {
    font-family: var(--ff-display);
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    padding-left: 1rem;
}
.nav-link {
    font-family: var(--ff-display);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    padding: 0.4rem 0.75rem;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link.active {
    color: var(--red);
    border-color: var(--red-dim);
    background: var(--red-glow);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.user-badge {
    width: 34px; height: 34px;
    background: var(--red-dim);
    border: 1px solid var(--red);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ff-display);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.user-name { font-size: 0.8rem; color: var(--text-dim); }
.btn-exit {
    font-family: var(--ff-display);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 0.3rem 0.7rem;
    transition: all 0.15s;
}
.btn-exit:hover { color: var(--red); border-color: var(--red-dim); text-decoration: none; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 2rem 4rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--ff-display);
    letter-spacing: 0.1em;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--red); }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--gap);
    padding-bottom: var(--gap);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}
.page-title {
    font-family: var(--ff-display);
    font-size: 2.4rem;
    letter-spacing: 0.05em;
    line-height: 1;
    color: var(--text);
}
.page-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    letter-spacing: 0.15em;
}

/* ── Stat grid ────────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: var(--gap);
}
@media (max-width: 700px) { .stat-grid { grid-template-columns: repeat(2,1fr); } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-light);
    padding: 1.25rem 1.5rem;
}
.stat-value {
    font-family: var(--ff-display);
    font-size: 2.6rem;
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--text);
}
.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    margin-top: 0.4rem;
}

/* ── Two-column layout ────────────────────────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ── Panel ────────────────────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
}
.panel.mt { margin-top: 1rem; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}
.panel-title {
    font-family: var(--ff-display);
    font-size: 1rem;
    letter-spacing: 0.15em;
    color: var(--text);
}

/* ── Data table ───────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.data-table th {
    font-family: var(--ff-display);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-align: left;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table .row--me { background: rgba(204,17,17,0.05); }
.data-table .row--win td:first-child { border-left: 3px solid var(--red); }
.data-table .row--loss td:first-child { border-left: 3px solid var(--text-muted); }

.table-note { font-size: 0.7rem; padding: 0.75rem 1.25rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--ff-display);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    padding: 0.5rem 1.1rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn--primary {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn--primary:hover { background: #e01313; border-color: #e01313; color: #fff; }

.btn--outline {
    background: transparent;
    color: var(--text-dim);
    border-color: var(--border-light);
}
.btn--outline:hover { color: var(--text); border-color: var(--text-dim); }

.btn--sm { font-size: 0.7rem; padding: 0.3rem 0.7rem; }
.btn--block { width: 100%; justify-content: center; }

/* ── Form fields ──────────────────────────────────────────────────────────── */
.field-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-family: var(--ff-display);
}
.field-input {
    display: block;
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--red-dim); }
.field-input option { background: var(--bg3); }
.field-textarea { min-height: 80px; resize: vertical; }
.field-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.4rem; }
.field-hint a { color: var(--text-dim); }
.mt { margin-top: 0.85rem; }
.mt-sm { margin-top: 0.5rem; }

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    border-left: 3px solid;
}
.flash--success { border-color: #2a7a2a; background: rgba(42,122,42,0.1); color: #6ec96e; }
.flash--error   { border-color: var(--red); background: var(--red-glow); color: #e07070; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    font-size: 0.6rem;
    font-family: var(--ff-display);
    letter-spacing: 0.1em;
    padding: 0.15rem 0.4rem;
    border: 1px solid;
}
.badge--red  { color: var(--red); border-color: var(--red-dim); background: var(--red-glow); }
.badge--gray { color: var(--text-dim); border-color: var(--border-light); }

/* ── Status pills ─────────────────────────────────────────────────────────── */
.status { font-size: 0.65rem; font-family: var(--ff-display); letter-spacing: 0.12em; padding: 0.1rem 0.4rem; }
.status--pending   { color: #b8940a; border: 1px solid #5a4700; background: rgba(184,148,10,0.1); }
.status--accepted  { color: var(--red); border: 1px solid var(--red-dim); background: var(--red-glow); }
.status--completed { color: #2a7a2a; border: 1px solid #1a4a1a; background: rgba(42,122,42,0.1); }
.status--cancelled, .status--expired { color: var(--text-muted); border: 1px solid var(--border); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.red   { color: var(--red); }
.dim   { color: var(--text-dim); }
.mono  { font-family: var(--ff-mono); }
.bold  { font-weight: 600; }
.empty-state { padding: 2rem 1.25rem; color: var(--text-muted); font-size: 0.85rem; }
.body-text { padding: 0 1.25rem; color: var(--text-dim); font-size: 0.82rem; line-height: 1.7; }

/* ── Fighter row (dashboard top 3) ───────────────────────────────────────── */
.fighter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.fighter-row:last-child { border-bottom: none; }
.rank { font-family: var(--ff-display); font-size: 1.1rem; width: 28px; flex-shrink: 0; }
.rank--1 { color: #d4af37; }
.rank--2 { color: #a8a8a8; }
.rank--3 { color: #b87333; }
.fighter-name { flex: 1; font-size: 0.88rem; }
.fighter-record { font-size: 0.8rem; }
.win-pct { font-size: 0.75rem; margin-left: auto; }

/* ── Challenges ───────────────────────────────────────────────────────────── */
.challenge-form { padding: 1.25rem; }
.challenge-list { display: flex; flex-direction: column; gap: 0; }
.challenge-card {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.challenge-card:last-child { border-bottom: none; }
.challenge-card--accepted { border-left: 2px solid var(--red); }
.challenge-fighters { font-size: 0.9rem; margin-bottom: 0.25rem; }
.vs { color: var(--text-muted); font-size: 0.7rem; font-family: var(--ff-display); letter-spacing: 0.15em; padding: 0 0.35rem; }
.challenge-msg { font-size: 0.8rem; color: var(--text-dim); font-style: italic; margin: 0.3rem 0; }
.challenge-meta { font-size: 0.7rem; margin: 0.4rem 0; }
.challenge-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }

/* ── Leaderboard podium ───────────────────────────────────────────────────── */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--gap);
    height: 200px;
}
.podium-slot {
    flex: 1;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 0;
}
.podium-crown { font-size: 1.4rem; margin-bottom: 0.25rem; }
.podium-badge {
    width: 46px; height: 46px;
    background: var(--bg3);
    border: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--ff-display);
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}
.podium-badge--1 { border-color: #d4af37; background: rgba(212,175,55,0.1); color: #d4af37; }
.podium-name { font-size: 0.78rem; font-weight: 600; text-align: center; margin-bottom: 0.2rem; }
.podium-record { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.5rem; }

.podium-bar {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
}
.podium-bar--1 { height: 90px; background: linear-gradient(to top, rgba(212,175,55,0.25), transparent); border-top: 2px solid #d4af37; }
.podium-bar--2 { height: 60px; background: linear-gradient(to top, rgba(168,168,168,0.15), transparent); border-top: 2px solid #888; }
.podium-bar--3 { height: 40px; background: linear-gradient(to top, rgba(184,115,51,0.15), transparent); border-top: 2px solid #b87333; }
.podium-rank { font-family: var(--ff-display); font-size: 1.2rem; color: var(--text-muted); }

.rank-cell { font-size: 1rem; }
.lb-table td, .lb-table th { padding: 0.65rem 1rem; }

/* ── Sync page ────────────────────────────────────────────────────────────── */
.sync-summary {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.sync-summary .stat-card { flex: 1; }
.sync-log { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.sync-entry { font-size: 0.8rem; padding: 0.5rem 0.75rem; border-left: 2px solid; }
.sync-entry--found    { border-color: #2a7a2a; background: rgba(42,122,42,0.07); }
.sync-entry--notfound { border-color: #5a4700; background: rgba(90,71,0,0.07); }
.sync-entry--error    { border-color: var(--red-dim); background: var(--red-glow); }
.panel > .mt { padding: 0 1.25rem 1.25rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 0.35rem; padding: 0.85rem 1.25rem; justify-content: center; }
.page-btn {
    font-family: var(--ff-display);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    min-width: 32px;
    text-align: center;
}
.page-btn:hover { color: var(--text); text-decoration: none; }
.page-btn--active { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Filter group ─────────────────────────────────────────────────────────── */
.filter-group { display: flex; gap: 0.35rem; align-items: center; }

/* ── Fight log table ──────────────────────────────────────────────────────── */
.fight-log-table { font-size: 0.78rem; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 60% 50% at 50% 60%, rgba(140,0,0,0.12) 0%, transparent 70%),
        var(--bg);
}
.login-wrap { width: 100%; padding: 2rem; display: flex; justify-content: center; }
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--red);
    padding: 2.5rem 2rem;
    position: relative;
}
.login-emblem {
    font-size: 2.5rem;
    text-align: center;
    display: block;
    margin-bottom: 0.75rem;
    color: var(--red);
}
.login-title {
    font-family: var(--ff-display);
    font-size: 3.5rem;
    letter-spacing: 0.06em;
    line-height: 0.95;
    text-align: center;
    margin-bottom: 0.5rem;
}
.login-sub {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    margin-bottom: 1.5rem;
}
.login-rule {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    border: 1px solid var(--border);
    padding: 0.6rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}
.login-form { display: flex; flex-direction: column; gap: 0.35rem; }
.login-disclaimer {
    margin-top: 1.5rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}
