/* ═══════════════════════════════════════════════════════════════════════════
   BOWLING LEAGUE — FEUILLE DE STYLE PRINCIPALE
   Français · LTR · Responsive · Sans dépendances externes
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
    /* Couleurs principales */
    --primary:        #1a2744;
    --primary-mid:    #243660;
    --primary-light:  #3b5ba9;

    /* Accent */
    --accent:         #3b82f6;
    --accent-hover:   #2563eb;
    --accent-light:   #dbeafe;

    /* États */
    --success:        #10b981;
    --success-bg:     #d1fae5;
    --success-border: #6ee7b7;
    --danger:         #ef4444;
    --danger-bg:      #fee2e2;
    --danger-border:  #fca5a5;
    --warning:        #f59e0b;
    --warning-bg:     #fef3c7;
    --warning-border: #fcd34d;
    --info:           #06b6d4;
    --info-bg:        #cffafe;
    --info-border:    #67e8f9;

    /* Médailles */
    --gold:           #fbbf24;
    --gold-bg:        rgba(251,191,36,.12);
    --silver:         #94a3b8;
    --silver-bg:      rgba(148,163,184,.12);
    --bronze:         #cd7f32;
    --bronze-bg:      rgba(205,127,50,.12);

    /* Interface */
    --bg:             #f1f5f9;
    --card-bg:        #ffffff;
    --border:         #e2e8f0;
    --border-hover:   #cbd5e1;
    --text:           #0f172a;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;

    /* Ombres */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.06);
    --shadow:     0 4px 10px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
    --shadow-md:  0 8px 20px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
    --shadow-lg:  0 16px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
    --shadow-xl:  0 24px 48px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.08);

    /* Layout */
    --max-width:  1180px;
    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    /* Typographie */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Transitions */
    --transition: all .2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

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

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

/* ── Typographie ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    flex: 1;
    padding-bottom: 4rem;
}

/* ── Navigation ─────────────────────────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    position: sticky;
    top: 0;
    z-index: 200;
}

.navbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #fff !important;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.3px;
    text-decoration: none;
}

.brand-icon { font-size: 1.7rem; line-height: 1; }
.brand-name { color: #fff; }

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .15rem;
}

.nav-links a,
.nav-logout-btn,
.nav-admin-link {
    color: rgba(255,255,255,.8);
    padding: .45rem .95rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    line-height: 1.6;
    text-decoration: none;
}

.nav-links a:hover,
.nav-logout-btn:hover,
.nav-admin-link:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
}

.nav-links a.active,
.nav-admin-link.active {
    color: #fff;
    background: rgba(255,255,255,.2);
}

/* Hamburger button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem .5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}
.nav-toggle:hover { background: rgba(255,255,255,.12); }

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
    position: relative;
}
.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}
.hamburger::before { top: -7px; }
.hamburger::after  { top:  7px; }

/* ── Hero Section ───────────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #243680 55%, var(--primary-light) 100%);
    color: #fff;
    padding: 4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(255,255,255,.06) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(255,255,255,.04) 0%, transparent 50%);
    pointer-events: none;
}

.hero-icon {
    font-size: 4.5rem;
    display: block;
    margin-bottom: 1rem;
    animation: float 3.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%       { transform: translateY(-10px) rotate(3deg); }
}

.hero h1 {
    color: #fff;
    font-size: 2.6rem;
    margin-bottom: .6rem;
    text-shadow: 0 2px 12px rgba(0,0,0,.3);
    letter-spacing: -.5px;
}

.hero p {
    color: rgba(255,255,255,.78);
    font-size: 1.1rem;
    max-width: 520px;
    margin: 0 auto;
}

/* ── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
    padding: 2rem 1.5rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 24px;
    background: var(--bg);
    border-radius: 24px 24px 0 0;
}

.page-header .container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    color: #fff;
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.breadcrumb {
    font-size: .8rem;
    color: rgba(255,255,255,.6);
    margin-bottom: .35rem;
}
.breadcrumb a { color: rgba(255,255,255,.75); }
.breadcrumb a:hover { color: #fff; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(135deg, #fafbfc, #f8fafc);
}

.card-header h2, .card-header h3 { margin: 0; }

.card-body { padding: 1.5rem; }

/* ── Stat Cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.6rem 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--primary-light));
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -20px; right: -20px;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-light), transparent);
    opacity: .5;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: .75rem;
}

.stat-card-value {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    margin-bottom: .4rem;
    letter-spacing: -1px;
}

.stat-card-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
}

/* ── Record Card ────────────────────────────────────────────────────────────── */
.record-card {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(251,191,36,.4);
    position: relative;
    overflow: hidden;
}

.record-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 150px; height: 150px;
    background: rgba(255,255,255,.18);
    border-radius: 50%;
}

.record-card::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -30px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
}

.record-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: .75rem;
    position: relative;
    z-index: 1;
}

.record-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(124,72,0,.85);
    margin-bottom: .5rem;
    position: relative;
    z-index: 1;
}

.record-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: #451a03;
    margin-bottom: .2rem;
    position: relative;
    z-index: 1;
}

.record-score {
    font-size: 4rem;
    font-weight: 900;
    color: #3d1a00;
    line-height: 1;
    letter-spacing: -2px;
    position: relative;
    z-index: 1;
}

.record-detail {
    font-size: .85rem;
    color: rgba(124,72,0,.8);
    margin-top: .75rem;
    position: relative;
    z-index: 1;
}

/* ── Quick Nav ──────────────────────────────────────────────────────────────── */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    font-size: .9rem;
    min-width: 500px;
}

thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
}

thead th {
    padding: 1rem 1.1rem;
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: rgba(255,255,255,.9);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .12s ease;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8faff; }

tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:nth-child(even):hover { background: #f1f5ff; }

td {
    padding: .85rem 1.1rem;
    vertical-align: middle;
}

/* ── Medals / Ranks ─────────────────────────────────────────────────────────── */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-weight: 700;
    font-size: .9rem;
    background: var(--border);
    color: var(--text-muted);
}

tr.rank-1 { background: var(--gold-bg)   !important; }
tr.rank-2 { background: var(--silver-bg) !important; }
tr.rank-3 { background: var(--bronze-bg) !important; }

tr.rank-1:hover { background: rgba(251,191,36,.2) !important; }
tr.rank-2:hover { background: rgba(148,163,184,.2) !important; }
tr.rank-3:hover { background: rgba(205,127,50,.2)  !important; }

tr.rank-1 td, tr.rank-2 td, tr.rank-3 td { font-weight: 600; }

/* The rank badge emoji is set via inline HTML */

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: .65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .9rem;
    color: var(--text);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

input.invalid, select.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
}
.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,.45); color: #fff; }
.btn-primary:active { transform: translateY(0); }

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.28);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16,185,129,.42); color: #fff; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.28);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(239,68,68,.42); color: #fff; }

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-hover); color: var(--text); }

.btn-outline-primary {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.btn-outline-primary:hover { background: var(--accent); color: #fff; }

.btn-sm  { padding: .38rem .85rem; font-size: .8rem; }
.btn-lg  { padding: .85rem 2rem;   font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Flash Messages ─────────────────────────────────────────────────────────── */
.flash {
    padding: .9rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 500;
    animation: slideDown .3s ease;
    line-height: 1.5;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success { background: var(--success-bg); color: #065f46; border: 1px solid var(--success-border); }
.flash-danger,
.flash-error   { background: var(--danger-bg);  color: #991b1b; border: 1px solid var(--danger-border);  }
.flash-warning { background: var(--warning-bg); color: #92400e; border: 1px solid var(--warning-border); }
.flash-info    { background: var(--info-bg);    color: #155e75; border: 1px solid var(--info-border);    }

/* ── Player Cards ───────────────────────────────────────────────────────────── */
#players-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.player-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    overflow: hidden;
    transition: box-shadow .2s ease, border-color .2s ease;
    animation: cardIn .25s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.player-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.08), var(--shadow);
}

.player-card-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: .85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    border-bottom: 1px solid var(--border);
}

.player-card-number {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-name-input {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    border: none !important;
    background: transparent !important;
    color: var(--text);
    padding: 0 !important;
    box-shadow: none !important;
    min-width: 0;
}

.player-name-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.player-name-input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.remove-player-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: .3rem .45rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
}

.remove-player-btn:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.player-card-body {
    padding: 1rem 1.25rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: .45rem;
}

.game-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
}

.game-cell label {
    font-size: .68rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: .3px;
    margin: 0;
    text-transform: uppercase;
}

.game-score-input {
    width: 100%;
    text-align: center;
    padding: .5rem .2rem;
    font-size: .9rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 0;
    background: #fafbfd;
}

.game-score-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
    background: #fff;
}

.game-score-input.has-value {
    border-color: var(--accent);
    background: rgba(59,130,246,.04);
    color: var(--primary);
}

.game-score-input.invalid {
    border-color: var(--danger);
    background: rgba(239,68,68,.04);
    animation: shake .3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-4px); }
    75%       { transform: translateX(4px); }
}

.player-stats-bar {
    display: flex;
    gap: 1.25rem;
    padding: .8rem 1.25rem;
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border-top: 1px solid #bfdbfe;
    flex-wrap: wrap;
}

.player-stat {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.player-stat-label {
    color: var(--text-muted);
    font-size: .78rem;
}

.player-stat-value {
    font-weight: 800;
    color: var(--primary);
    font-size: .92rem;
    min-width: 28px;
}

/* ── Login Page ─────────────────────────────────────────────────────────────── */
.login-wrapper {
    min-height: calc(100vh - 64px - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}

.login-icon {
    text-align: center;
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1.25rem;
}

.login-card h1 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: .3rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 2rem;
}

/* ── Section Headers ────────────────────────────────────────────────────────── */
.section { padding: 2rem 0; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .45rem;
}

/* ── Week List ──────────────────────────────────────────────────────────────── */
.week-list {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.week-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: var(--transition);
}

.week-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.week-item-info h4 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.week-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.week-item-actions {
    display: flex;
    gap: .4rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
    line-height: 1.5;
}

.badge-primary { background: var(--accent-light); color: #1e40af; }
.badge-success { background: var(--success-bg);   color: #065f46; }
.badge-warning { background: var(--warning-bg);   color: #92400e; }
.badge-danger  { background: var(--danger-bg);    color: #991b1b; }
.badge-neutral { background: var(--border);        color: var(--text-muted); }

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1.5px dashed var(--border);
}

.empty-state-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    opacity: .55;
}

.empty-state h3 {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.empty-state p { font-size: .9rem; margin-bottom: 0; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 9999;
    max-width: 340px;
    border-radius: var(--radius);
    padding: .9rem 1.25rem;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn .3s ease;
    transition: opacity .3s ease, transform .3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,.5);
    text-align: center;
    padding: 1.5rem;
    font-size: .8rem;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.footer-logo { font-size: 1.1rem; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.nowrap      { white-space: nowrap; }

.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.flex-wrap      { flex-wrap: wrap; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }

.mt-1 { margin-top: .5rem;  }
.mt-2 { margin-top: 1rem;   }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem;   }
.mb-1 { margin-bottom: .5rem;  }
.mb-2 { margin-bottom: 1rem;   }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem;   }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: #1e3260;
        box-shadow: 0 8px 20px rgba(0,0,0,.25);
        z-index: 199;
    }

    .nav-links.open { display: flex; }

    .navbar { position: relative; }
    .navbar-inner { flex-wrap: wrap; }

    .nav-links li { width: 100%; }

    .nav-links a,
    .nav-logout-btn,
    .nav-admin-link {
        width: 100%;
        padding: .85rem 1.5rem;
        border-radius: 0;
        display: block;
        text-align: left;
    }

    .hero h1 { font-size: 1.9rem; }
    .hero { padding: 3rem 1.5rem; }

    .page-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .week-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .week-item-actions { width: 100%; }
}

@media (max-width: 540px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .stat-card-value { font-size: 1.8rem; }

    .login-card { padding: 2rem 1.25rem; }

    .hero h1 { font-size: 1.6rem; }

    .record-score { font-size: 3rem; }

    table { font-size: .8rem; }
    td, thead th { padding: .7rem .75rem; }

    .games-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: .35rem;
    }

    .player-stats-bar { gap: .75rem; }

    .btn-lg { padding: .75rem 1.5rem; }
}
