/* ═══════════════════════════════════════════════════════════
   BAKVOETBAL RANKING — Apple-inspired Design
   Clean, minimal, professional.
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=JetBrains+Mono:wght@400;600;700;800&display=swap');

:root {
    --bg: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFAFA;
    --bg-input: #F5F5F7;
    --border: #E5E5EA;
    --border-light: #F0F0F5;

    --text: #1D1D1F;
    --text-secondary: #424245;
    --text-muted: #6E6E73;
    --text-dim: #86868B;
    --text-faint: #AEAEB2;

    --accent: #C97B1A;
    --accent-light: #E09530;
    --accent-bg: rgba(201,123,26,0.08);
    --accent-border: rgba(201,123,26,0.2);

    --green: #34C759;
    --green-bg: rgba(52,199,89,0.08);
    --red: #FF3B30;
    --red-bg: rgba(255,59,48,0.08);
    --blue: #007AFF;
    --blue-bg: rgba(0,122,255,0.08);
    --orange: #FF9500;
    --orange-bg: rgba(255,149,0,0.08);

    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', monospace;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

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

a { color: var(--accent); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .8; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text); letter-spacing: -0.02em; }
h1 { font-size: 1.625rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 52px;
}
.navbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}
.navbar-brand {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.03em;
}
.navbar-brand img { height: 24px; width: auto; }
.navbar-brand .brand-dot { color: var(--accent); }
.navbar-links {
    display: flex;
    align-items: center;
    gap: 2px;
}
.nav-link {
    padding: 6px 12px;
    border-radius: var(--r-full);
    color: var(--text-muted);
    font-size: .8125rem;
    font-weight: 500;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: rgba(0,0,0,0.04); opacity: 1; }
.nav-link.active { color: var(--accent); background: var(--accent-bg); }
.nav-badge {
    background: var(--red);
    color: #fff;
    font-size: .625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-full);
    padding: 0 4px;
}
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--r-md);
}
.nav-toggle:hover { background: rgba(0,0,0,0.04); }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .navbar-links {
        display: none;
        position: absolute;
        top: 52px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
        padding: 8px;
    }
    .navbar-links.open { display: flex; }
    .nav-link { width: 100%; padding: 12px 16px; border-radius: var(--r-md); }
}

/* Language switcher */
.lang-switch { display: flex; gap: 2px; margin-left: 8px; }
.lang-btn {
    padding: 4px 8px;
    border-radius: var(--r-sm);
    font-size: .6875rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    background: none;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.lang-btn:hover, .lang-btn.active { color: var(--accent); background: var(--accent-bg); opacity: 1; }

/* ─── Main Content ───────────────────────────────────── */
.main-content {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
    flex: 1;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 700; }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--r-full);
    font-family: var(--font);
    font-size: .8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #b06e17; color: #fff; opacity: 1; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #2db550; color: #fff; opacity: 1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #e0342a; color: #fff; opacity: 1; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(0,0,0,0.03); color: var(--text); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: .75rem; }
.btn-lg { padding: 12px 28px; font-size: .9375rem; }
.btn-block { width: 100%; }

/* ─── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    font-family: var(--font);
    font-size: .9375rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-input::placeholder { color: var(--text-faint); }
.form-hint { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .875rem; color: var(--text-secondary); }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ─── Score Input ────────────────────────────────────── */
.score-input-group { display: flex; align-items: center; gap: 16px; justify-content: center; }
.score-input {
    width: 72px; height: 72px;
    text-align: center; font-size: 1.75rem; font-weight: 800;
    font-family: var(--mono);
    background: var(--bg-input); border: 2px solid var(--border);
    border-radius: var(--r-lg); color: var(--text); outline: none;
    transition: border-color .2s;
}
.score-input:focus { border-color: var(--accent); }
.score-divider { font-size: 1.5rem; font-weight: 700; color: var(--text-dim); }

/* ─── Flash Messages ─────────────────────────────────── */
.flash-messages { max-width: 1080px; margin: 0 auto; padding: 8px 20px; }
.flash {
    padding: 12px 20px;
    border-radius: var(--r-md);
    margin-bottom: 8px;
    font-size: .875rem; font-weight: 500;
    animation: flash-in .3s ease;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: var(--green-bg); color: #1a7d3a; border: 1px solid rgba(52,199,89,0.2); }
.flash-error { background: var(--red-bg); color: #cc2e25; border: 1px solid rgba(255,59,48,0.2); }
.flash-info { background: var(--blue-bg); color: #0062cc; border: 1px solid rgba(0,122,255,0.2); }
.flash-warning { background: var(--orange-bg); color: #b36a00; border: 1px solid rgba(255,149,0,0.2); }

/* ─── Stats Grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-value { font-family: var(--mono); font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: .6875rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

/* ─── Elo ────────────────────────────────────────────── */
.elo-rating { font-family: var(--mono); font-weight: 700; }
.elo-big { font-size: 2.25rem; letter-spacing: -0.03em; }
.elo-change { font-family: var(--mono); font-weight: 600; font-size: .8125rem; }
.elo-up { color: var(--green); }
.elo-down { color: var(--red); }
.elo-neutral { color: var(--text-dim); }
.provisional-badge {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--accent-bg); color: var(--accent);
    padding: 2px 6px; border-radius: var(--r-full);
    font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

/* ─── Match List ─────────────────────────────────────── */
.match-list { list-style: none; }
.match-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.match-item:last-child { border-bottom: none; }
.match-players { flex: 1; display: flex; align-items: center; gap: 6px; font-size: .875rem; min-width: 0; }
.match-player { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-player a { color: inherit; }
.match-player.winner { color: var(--green); }
.match-player.loser { color: var(--text-muted); }
.match-vs { color: var(--text-faint); font-size: .6875rem; font-weight: 600; flex-shrink: 0; }
.match-score { font-family: var(--mono); font-weight: 800; font-size: 1rem; white-space: nowrap; flex-shrink: 0; }
.match-meta { font-size: .6875rem; color: var(--text-dim); white-space: nowrap; }
.match-elo-change { font-family: var(--mono); font-size: .75rem; font-weight: 600; min-width: 36px; text-align: right; flex-shrink: 0; }

/* ─── Ranking Table ──────────────────────────────────── */
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th {
    text-align: left; font-size: .6875rem; font-weight: 700;
    color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.ranking-table td { padding: 12px; border-bottom: 1px solid var(--border-light); font-size: .875rem; }
.ranking-table tr:hover td { background: var(--bg-card-hover); }
.rank-number { font-family: var(--mono); font-weight: 800; color: var(--text-dim); }
.rank-1 .rank-number { color: #FFD700; }
.rank-2 .rank-number { color: #C0C0C0; }
.rank-3 .rank-number { color: #CD7F32; }
.rank-username { display: flex; align-items: center; gap: 6px; }
.rank-username a { font-weight: 600; color: var(--text); }
.rank-username a:hover { color: var(--accent); opacity: 1; }

/* ─── Pending Match ──────────────────────────────────── */
.pending-card {
    background: var(--bg-card); border: 1px solid var(--accent-border);
    border-radius: var(--r-lg); padding: 20px; margin-bottom: 12px;
}
.pending-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.counter-form { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.counter-form.open { display: block; }

/* ─── Profile ────────────────────────────────────────── */
.profile-header { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.profile-avatar {
    width: 72px; height: 72px; border-radius: var(--r-full);
    background: linear-gradient(135deg, var(--accent), #e09530);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; font-weight: 800; color: #fff; flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-username { font-size: 1.375rem; font-weight: 800; margin-bottom: 4px; }
.profile-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8125rem; color: var(--text-muted); }

/* ─── Achievements ───────────────────────────────────── */
.achievements-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.achievement-badge {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--r-full); padding: 6px 12px;
    font-size: .8125rem; font-weight: 500; color: var(--text-secondary);
}
.achievement-badge .icon { font-size: 1.125rem; }

/* ─── Feed ───────────────────────────────────────────── */
.feed-list { list-style: none; }
.feed-item {
    padding: 10px 0; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: flex-start; gap: 10px; font-size: .8125rem;
}
.feed-icon {
    width: 28px; height: 28px; border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    font-size: .8125rem; flex-shrink: 0;
}
.feed-icon.match { background: var(--green-bg); }
.feed-icon.user { background: var(--blue-bg); }
.feed-icon.streak { background: var(--orange-bg); }
.feed-icon.gotw { background: var(--accent-bg); }
.feed-text { flex: 1; line-height: 1.4; color: var(--text-secondary); }
.feed-text strong { color: var(--text); font-weight: 600; }
.feed-time { color: var(--text-dim); font-size: .6875rem; white-space: nowrap; }

/* ─── Search Autocomplete ────────────────────────────── */
.search-wrapper { position: relative; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-md); margin-top: 4px;
    max-height: 220px; overflow-y: auto; z-index: 50;
    box-shadow: var(--shadow-lg); display: none;
}
.search-results.open { display: block; }
.search-result-item {
    padding: 8px 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-name { font-weight: 600; font-size: .875rem; }
.search-result-elo { font-family: var(--mono); font-size: .75rem; color: var(--text-muted); }

/* ─── Elo Chart ──────────────────────────────────────── */
.elo-chart-container { width: 100%; height: 180px; }

/* ─── Hero ───────────────────────────────────────────── */
.hero { text-align: center; padding: 64px 20px; }
.hero h1 {
    font-size: 2.5rem; font-weight: 900; letter-spacing: -0.04em;
    margin-bottom: 16px; color: var(--text);
}
.hero h1 .accent { color: var(--accent); }
.hero-subtitle { font-size: 1.0625rem; color: var(--text-muted); max-width: 480px; margin: 0 auto 32px; line-height: 1.5; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 48px; justify-content: center; margin-top: 48px; }
.hero-stat-value { font-family: var(--mono); font-size: 1.75rem; font-weight: 800; color: var(--text); }
.hero-stat-label { font-size: .75rem; color: var(--text-dim); font-weight: 500; }

/* ─── Hero Image Placeholder ─────────────────────────── */
.hero-image {
    max-width: 600px; margin: 40px auto 0;
    background: var(--bg-input); border-radius: var(--r-xl);
    padding: 40px; text-align: center; color: var(--text-dim);
    border: 2px dashed var(--border);
}

/* ─── Game of the Week ───────────────────────────────── */
.gotw-card {
    background: linear-gradient(135deg, var(--accent-bg), rgba(255,149,0,0.06));
    border: 1px solid var(--accent-border);
    border-radius: var(--r-xl); padding: 24px;
}

/* ─── Tournament ─────────────────────────────────────── */
.tournament-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px;
    transition: border-color .15s;
}
.tournament-card:hover { border-color: var(--accent-border); }
.tournament-format {
    display: inline-block; padding: 2px 8px; border-radius: var(--r-full);
    font-size: .6875rem; font-weight: 700; text-transform: uppercase;
}
.format-ko { background: var(--red-bg); color: var(--red); }
.format-group { background: var(--blue-bg); color: var(--blue); }
.format-combo { background: var(--accent-bg); color: var(--accent); }

.bracket-round { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.bracket-match {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 8px 12px; font-size: .8125rem;
}
.bracket-container { display: flex; gap: 24px; overflow-x: auto; padding: 16px 0; }

.group-table { width: 100%; border-collapse: collapse; font-size: .8125rem; margin-bottom: 12px; }
.group-table th { text-align: left; font-size: .6875rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.group-table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.group-name { font-weight: 700; font-size: .875rem; margin-bottom: 8px; }

/* ─── Notifications ──────────────────────────────────── */
.notif-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: opacity .15s;
}
.notif-item:hover { opacity: .85; }
.notif-item.unread { font-weight: 500; }
.notif-item.unread::before {
    content: ''; width: 8px; height: 8px;
    background: var(--accent); border-radius: var(--r-full); flex-shrink: 0;
}
.notif-item.read { opacity: .6; }
.notif-content { flex: 1; }
.notif-title { font-size: .875rem; color: var(--text); }
.notif-time { font-size: .6875rem; color: var(--text-dim); }

.notif-settings-grid { display: grid; gap: 8px; }
.notif-setting-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 16px;
    align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-light);
    font-size: .875rem;
}

/* ─── Verify Code Input ──────────────────────────────── */
.code-input {
    font-family: var(--mono); font-size: 2rem; font-weight: 800;
    letter-spacing: .5em; text-align: center;
    padding: 16px; width: 100%; max-width: 300px;
    background: var(--bg-input); border: 2px solid var(--border);
    border-radius: var(--r-lg); outline: none; color: var(--text);
}
.code-input:focus { border-color: var(--accent); }

/* ─── Layout Grids ───────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    h1 { font-size: 1.375rem; }
    .hero h1 { font-size: 2rem; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-meta { justify-content: center; }
    .hero-stats { gap: 24px; }
}

/* ─── Pagination ─────────────────────────────────────── */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 20px 0; }
.page-link {
    padding: 6px 12px; border-radius: var(--r-md);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); font-size: .8125rem; font-weight: 600;
}
.page-link:hover { background: var(--bg-card-hover); color: var(--text); opacity: 1; }
.page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-link.disabled { opacity: .3; pointer-events: none; }

/* ─── Footer ─────────────────────────────────────────── */
.footer {
    background: var(--bg-card); border-top: 1px solid var(--border);
    padding: 32px 20px; margin-top: auto;
    text-align: center; color: var(--text-dim); font-size: .75rem;
}
.footer a { color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }

/* ─── Empty State ────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 12px; }

/* ─── Animations ─────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fade-in .4s ease both; }
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .1s; }
.delay-3 { animation-delay: .15s; }

/* ─── Utility ────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: .8125rem; }
.text-xs { font-size: .6875rem; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.hidden { display: none; }
.w-full { width: 100%; }

/* Admin suspicious */
.suspicious-item {
    background: var(--red-bg); border: 1px solid rgba(255,59,48,0.15);
    border-radius: var(--r-md); padding: 12px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
}
