/* =========================================
   1. Variables & Reset
   ========================================= */
:root {
    --primary:       #1a3350;
    --accent:        #e8623a;
    --accent-dark:   #c94e28;
    --blue:          #0086a8;
    --success:       #276749;
    --danger:        #c0392b;
    --warning:       #d97706;

    --bg:            #eef2f7;
    --surface:       #ffffff;
    --surface-alt:   #f5f8fb;
    --border:        #dde4ec;
    --border-strong: #b8c8d8;

    --text:          #1e293b;
    --text-muted:    #5f7285;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow:     0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.1),  0 2px 6px rgba(0,0,0,0.07);

    --radius:     10px;
    --radius-sm:  5px;
    --header-h:   60px;
    --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

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

/* =========================================
   2. Header
   ========================================= */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-h);
}

.header-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.logo span {
    color: var(--accent);
    font-size: 1.2rem;
}

/* =========================================
   3. Navigation Desktop
   ========================================= */
nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

nav ul li a,
nav ul li .dropbtn {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    display: block;
}

nav ul li a:hover,
nav ul li .dropbtn:hover,
nav ul li a.active {
    background: var(--bg);
    color: var(--accent);
}

/* Dropdown desktop */
.dropdown { position: relative; }

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 200;
    overflow: hidden;
}

.dropdown-content a {
    display: block;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--surface-alt);
    transition: background 0.12s;
}

.dropdown-content a:last-child { border-bottom: none; }

.dropdown-content a:hover {
    background: var(--bg);
    color: var(--accent);
}

.dropdown:hover .dropdown-content { display: block; }

/* =========================================
   4. Header Actions
   ========================================= */
.header-actions { flex-shrink: 0; }

.admin-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    display: inline-block;
    text-decoration: none;
}

.admin-btn:hover { background: var(--accent-dark); }
.admin-btn.logout { background: var(--primary); }
.admin-btn.logout:hover { background: #0f2236; }

.logout-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 10px;
}
.logout-link:hover { color: var(--danger); text-decoration: underline; }

/* Nav footer (admin btn inside mobile panel) */
.nav-footer { display: none; }

/* =========================================
   5. Burger Menu
   ========================================= */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.burger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.burger-menu.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-menu.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger-menu.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    backdrop-filter: blur(1px);
}
.nav-overlay.active { display: block; }

/* =========================================
   6. Main Layout
   ========================================= */
main {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}

main.container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

main.container-full {
    max-width: calc(100% - 2.5rem);
    margin-left: auto;
    margin-right: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

/* =========================================
   7. Typography
   ========================================= */
h1 { font-size: 1.5rem; color: var(--primary); }

h2 {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: -0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

/* =========================================
   8. Buttons
   ========================================= */
.btn, .btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

.btn:hover, .btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 2px 8px rgba(232,98,58,0.3);
}

.btn-secondary {
    display: inline-block;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
    line-height: 1.5;
}

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

.btn-danger {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s;
}
.btn-danger:hover { filter: brightness(110%); }

.btn-delete {
    color: var(--danger);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    display: inline-block;
}
.btn-delete:hover { background: #fef2f2; }

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-print:hover { background: var(--bg); border-color: var(--primary); }

.btn-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* =========================================
   9. Cards & Forms
   ========================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232,98,58,0.12);
}

select.form-control {
    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 d='M1 1l5 5 5-5' stroke='%235f7285' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.4rem;
    cursor: pointer;
}

/* =========================================
   10. Alerts
   ========================================= */
.alert-success {
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid #a7f3d0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

/* =========================================
   11. Tables (General)
   ========================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.table-responsive.no-max-height {
    max-height: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 0.9rem;
}

th {
    background: var(--primary);
    color: #fff;
    padding: 0.7rem 1rem;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }

/* =========================================
   12. Page Header (Classement)
   ========================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 { margin-bottom: 0; }

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sort-options {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 1rem;
    font-size: 0.875rem;
}

.sort-options .sort-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-right: 0.2rem;
}

.sort-options a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    transition: color 0.12s;
}

.sort-options a:hover,
.sort-options a.active { color: var(--accent); }
.sort-options a.active { font-weight: 700; }

.sort-sep { color: var(--border-strong); font-size: 0.8rem; }

.filter-joues {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-joues-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-joues-select {
    padding: 0.3rem 1.8rem 0.3rem 0.6rem;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface-alt);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235f7285' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    transition: border-color 0.15s;
}

.filter-joues-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Classement columns */
.col-pos {
    width: 48px;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.col-joueur { min-width: 160px; }

.col-victoires,
.col-joues,
.col-ratio {
    text-align: center;
    width: 75px;
}

.active-sort { background: var(--blue) !important; }
.active-cell { font-weight: 700; }

.player-name {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    gap: 1px;
}

.player-name .lastname {
    font-weight: 600;
    font-size: 0.9rem;
}

.player-name .firstname {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-abandoned {
    background: #fffbf0 !important;
}

.player-abandoned .lastname,
.player-abandoned .firstname {
    text-decoration: line-through;
    opacity: 0.55;
}

.abandon-badge {
    color: var(--danger);
    font-size: 0.75em;
    font-style: italic;
    text-decoration: none !important;
    font-weight: 600;
}

/* Actions admin bar on home */
.actions-admin {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

/* =========================================
   13. Cross Table (Matchs Aller / Retour)
   ========================================= */
.matchs-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.cross-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: var(--surface);
}

.cross-table th,
.cross-table td {
    border: 1px solid #c8d4de;
    padding: 5px;
    text-align: center;
    font-size: 0.84rem;
}

.corner-header {
    background: var(--primary) !important;
    color: #fff;
    width: 200px;
    text-align: left !important;
    padding-left: 10px !important;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.col-header {
    background: var(--primary) !important;
    color: #fff;
    height: 160px;
    white-space: nowrap;
    padding: 0 !important;
    vertical-align: bottom;
}

.name-vertical-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 100%;
    width: 35px;
}

.name-vertical {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: left;
    height: 150px;
    padding: 5px 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.row-header {
    background: var(--surface-alt) !important;
    font-weight: 600;
    text-align: left !important;
    white-space: nowrap;
    padding-left: 10px !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.diagonal {
    background: #dce4ed !important;
    width: 35px;
}

.result-cell {
    width: 35px;
    transition: background 0.12s;
    font-weight: 600;
    font-size: 0.8rem;
}

.result-cell.win  { background: #d1fae5; color: #065f46; }
.result-cell.loss { background: #fee2e2; color: #991b1b; }

.cross-table tr:hover { background: var(--surface-alt); }
.cross-table td:hover { background: var(--border) !important; }

.total-header {
    background: var(--blue) !important;
    color: #fff;
    font-weight: 700;
}

.total-cell {
    background: #eff6ff;
    font-weight: 700;
    color: var(--primary);
}

.highlight-header {
    background: var(--blue) !important;
    color: #fff !important;
}

.full-width-table { table-layout: fixed; }

/* =========================================
   14. Matchs par Joueurs
   ========================================= */
.filter-section {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.selected-player-container { margin-bottom: 2rem; }

.matches-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.matches-column {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.matches-column h4 {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.players-matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.player-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.player-section > .player-name {
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.matchs-table {
    width: 100%;
    border-collapse: collapse;
}

.matchs-table th {
    text-align: left;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--border);
    background: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.matchs-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.matchs-table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-win  { background: #d1fae5; color: #065f46; }
.badge-loss { background: #fee2e2; color: #991b1b; }
.badge-draw { background: var(--surface-alt); color: var(--text-muted); }

.match-win  { background: rgba(209,250,229,0.3); }
.match-loss { background: rgba(254,226,226,0.3); }

.no-matches {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

/* =========================================
   15. Admin Pages
   ========================================= */

/* Section header avec titre + tabs alignés */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
}

/* Tabs */
.nav-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
}

.nav-tab {
    padding: 0.45rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.nav-tab:hover { color: var(--text); }

.nav-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    transition: background 0.15s, color 0.15s;
}

.nav-tab.active .tab-count {
    background: rgba(232,98,58,0.15);
    color: var(--accent);
}

/* Inline result form */
.form-inline-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.select-result {
    flex: 1;
    min-width: 150px;
    max-width: 260px;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235f7285' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.select-result:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232,98,58,0.1);
}

.btn-sm {
    padding: 0.32rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.col-result-inline { min-width: 280px; }

.vs {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0 0.2rem;
}

.all-done {
    color: var(--success);
    font-weight: 600;
    padding: 1rem 0;
}
.admin-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.col-type   { width: 80px; }
.col-match  { }
.col-gagnant { width: 28%; }
.col-action { width: 110px; text-align: center; }

.badge-abandon {
    display: inline-block;
    background: #fef3cd;
    color: #856404;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* =========================================
   16. Utilities
   ========================================= */
.name-short, .header-short, .print-only-name { display: none; }

/* =========================================
   17. Responsive — Tablette (max 1024px)
   ========================================= */
@media (max-width: 1024px) {
    main.container-full {
        max-width: calc(100% - 2rem);
        padding: 1.5rem;
    }
}

/* =========================================
   18. Responsive — Mobile (max 768px)
   ========================================= */
@media (max-width: 768px) {

    /* --- Header --- */
    .header-container { padding: 0 1rem; }
    .burger-menu { display: flex; }

    /* --- Mobile Nav panel (slide from right) --- */
    nav {
        position: fixed;
        top: var(--header-h);
        right: -100%;
        width: min(300px, 80vw);
        height: calc(100dvh - var(--header-h));
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: -4px 0 24px rgba(0,0,0,0.14);
        transition: right 0.28s ease;
        z-index: 999;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    nav.active { right: 0; }

    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        align-items: stretch;
    }

    nav ul li { width: 100%; }

    nav ul li a,
    nav ul li .dropbtn {
        padding: 0.9rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: none;
    }

    nav ul li a:hover,
    nav ul li .dropbtn:hover { background: var(--bg); color: var(--accent); }

    /* Disable hover-based dropdown on mobile */
    .dropdown:hover .dropdown-content { display: none; }
    .dropdown.active .dropdown-content { display: block; }

    .dropdown-content {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: var(--bg);
    }

    .dropdown-content a {
        padding: 0.7rem 1.25rem 0.7rem 2rem;
        font-size: 0.875rem;
        border-bottom: 1px solid var(--border);
    }

    .dropdown-content a:hover { background: #e8ecf2; }

    /* Admin button inside mobile nav */
    .header-actions { display: none; }

    .nav-footer {
        display: block;
        padding: 1rem 1.25rem;
        border-top: 1px solid var(--border);
        margin-top: auto;
    }

    .nav-footer .admin-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: var(--radius-sm);
        text-align: center;
        display: block;
    }

    /* --- Main Content --- */
    main {
        margin: 0;
        padding: 0;
    }

    main.container,
    main.container-full {
        border-radius: 0;
        box-shadow: none;
        padding: 1.25rem 1rem;
        max-width: 100%;
    }

    /* --- Typography --- */
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1rem; }

    /* --- Page header --- */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-joues-label { display: none; }

    .filter-joues-select { font-size: 0.85rem; }

    /* --- Actions admin --- */
    .actions-admin {
        flex-direction: column;
    }

    .actions-admin .btn,
    .actions-admin .btn-secondary {
        width: 100%;
        text-align: center;
    }

    /* --- Forms --- */
    .form-control,
    select.form-control {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 0.7rem 0.9rem;
        min-height: 46px;
    }

    select.form-control { padding-right: 2.4rem; }

    .card { padding: 1.1rem; }

    /* --- Tables --- */
    th { font-size: 0.72rem; padding: 0.6rem 0.75rem; }
    td { padding: 0.65rem 0.75rem; font-size: 0.875rem; }

    /* --- Short names --- */
    .name-full, .header-full { display: none; }
    .name-short, .header-short { display: inline; }

    /* --- Classement : no horizontal scroll --- */
    .table-classement {
        table-layout: fixed;
        width: 100%;
    }

    .table-classement .col-pos       { width: 32px; padding-left: 6px; padding-right: 4px; }
    .table-classement .col-joueur    { width: auto; }
    .table-classement .col-victoires,
    .table-classement .col-joues,
    .table-classement .col-ratio     { width: 42px; padding-left: 4px; padding-right: 4px; text-align: center; }

    .table-classement td,
    .table-classement th             { font-size: 0.82rem; padding: 0.6rem 4px; }

    .table-classement .player-name .lastname  { font-size: 0.82rem; }
    .table-classement .player-name .firstname { font-size: 0.72rem; }

    /* --- Cross table --- */
    .row-header {
        font-size: 0.72rem;
        padding-left: 5px !important;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .corner-header {
        width: 100px;
        max-width: 100px;
        font-size: 0.68rem;
    }

    .col-header { height: 110px; }

    .name-vertical {
        height: 100px;
        font-size: 0.7rem;
    }

    .cross-table,
    .table-responsive table {
        width: max-content;
        min-width: 100%;
    }

    /* --- Matchs par joueurs --- */
    .matches-grid         { grid-template-columns: 1fr; }
    .players-matches-grid { grid-template-columns: 1fr; }

    .filter-section {
        flex-direction: column;
        gap: 0.85rem;
        padding: 1rem;
    }

    .filter-group { min-width: 100%; }

    /* --- Admin cards --- */
    .admin-cards { grid-template-columns: 1fr; }

    /* --- Matchs non saisis mobile --- */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-tabs { width: 100%; overflow-x: auto; }

    .nav-tab { padding: 0.45rem 0.75rem; font-size: 0.82rem; }

    .form-inline-result { flex-wrap: wrap; }

    .select-result { min-width: 0; max-width: 100%; flex: 1 1 140px; }

    .col-result-inline { min-width: 0; }

    /* --- Btn bar --- */
    .btn-bar {
        flex-direction: column;
    }

    .btn-bar .btn,
    .btn-bar .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .btn-print {
        width: 100%;
        justify-content: center;
    }

    .matchs-actions { justify-content: center; }

    /* --- Admin matchs columns --- */
    .col-match {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* =========================================
   19. Print
   ========================================= */
@media print {
    .no-print,
    header,
    .admin-btn,
    .logout-link,
    .matchs-actions,
    .actions-admin,
    .burger-menu,
    .nav-overlay,
    .btn-bar,
    .filter-section { display: none !important; }

    body { background: white; }

    main.container,
    main.container-full {
        box-shadow: none;
        margin: 0;
        padding: 0;
        max-width: 100%;
        border-radius: 0;
    }

    h2 {
        color: black !important;
        border-bottom: 2px solid #333;
        padding-bottom: 8px;
        margin-bottom: 16px;
    }

    .cross-table, table { border: 1px solid black !important; }

    .cross-table th,
    .cross-table td,
    th, td { border: 1px solid black !important; color: black !important; }

    .corner-header, .col-header, .total-header, thead th {
        background: #f0f0f0 !important;
        color: black !important;
    }

    .result-cell.win  { background: #e8f5e9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .result-cell.loss { background: #ffebee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .diagonal         { background: #eee !important;    -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    .col-header     { height: 120px !important; }
    .name-vertical  { height: 110px !important; font-size: 0.75rem; }
    .name-vertical-wrapper { width: 45px !important; }

    .table-responsive { overflow: visible !important; max-height: none !important; }

    .corner-header,
    .row-header { width: 100px !important; min-width: 100px !important; }

    .result-cell,
    .diagonal   { width: 45px !important; min-width: 45px !important; }

    .no-print-name,
    .header-full.no-print-name { display: none !important; }

    .print-only-name,
    .header-short.print-only-name { display: inline !important; font-size: 0.8rem; }
}
