/* --- VARIABLES (Light Mode) --- */
:root {
    --bg-color: #F8F8F9; 
    --text-color: #1C1C1E;
    --text-secondary: #8E8E93;
    --gold-gradient: linear-gradient(135deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C);
    --gold-solid: #C5A059;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    
    /* MODIFICATION ICI : Fond blanc pur en mode clair */
    --avatar-bg: #FFFFFF; 
    --avatar-text: #1C1C1E;
}

/* --- VARIABLES (Dark Mode) --- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0A0A0C;
        --text-color: #F5F5F7;
        --text-secondary: #A1A1A6;
        --glass-bg: rgba(20, 20, 22, 0.75);
        --glass-border: rgba(200, 170, 90, 0.15);
        
        /* MODIFICATION ICI : Fond gris très foncé (presque noir) en mode sombre */
        --avatar-bg: #1C1C1E; 
        --avatar-text: #F5F5F7;
    }
}

* {
    box-sizing: border-box; margin: 0; padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color); color: var(--text-color);
    display: flex; justify-content: center; align-items: center;
    height: 100vh; overflow: hidden;
}

.login-screen { text-align: center; width: 100%; max-width: 420px; padding: 20px; }

/* Titre Premium */
.header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 38px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; /* Applique le dégradé au texte */
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.header p { 
    color: var(--text-secondary); text-transform: uppercase; 
    font-size: 11px; letter-spacing: 2px; margin-bottom: 50px; 
}

/* Disposition organique des avatars */
.avatar-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 25px 35px; }

.avatar-btn {
    background: none; border: none; color: var(--text-color);
    cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 12px;
    transition: transform 0.3s ease;
}

.avatar-btn:active { transform: scale(0.92); }

/* Effet Anneau Doré (Biseau) */
.avatar-ring {
    width: 76px; height: 76px; border-radius: 50%;
    background: var(--gold-gradient);
    padding: 2px; /* C'est l'épaisseur du bord doré */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.avatar-inner {
    width: 100%; height: 100%; border-radius: 50%;
    background-color: var(--avatar-bg); color: var(--gold-solid);
    display: flex; justify-content: center; align-items: center;
    font-size: 20px; font-family: 'Playfair Display', serif;
}

.avatar-btn span { font-size: 13px; font-weight: 500; letter-spacing: 0.5px; }

/* --- PAVÉ NUMÉRIQUE HAUTE COUTURE --- */
.pin-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.2); /* Assombrit légèrement le fond */
    display: flex; justify-content: center; align-items: flex-end;
    z-index: 100; transition: opacity 0.4s ease, backdrop-filter 0.4s ease;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

.pin-overlay.hidden { opacity: 0; pointer-events: none; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }

/* La dalle de verre qui monte de bas en haut */
.pin-glass-panel {
    width: 100%; max-width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); /* Flou très intense */
    border-top: 1px solid var(--glass-border);
    border-radius: 30px 30px 0 0;
    padding: 40px 20px 50px;
    text-align: center;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    transform: translateY(0); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-overlay.hidden .pin-glass-panel { transform: translateY(100%); }

#pin-title { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--text-color); font-weight: 400; }

.pin-dots { display: flex; justify-content: center; gap: 20px; margin: 35px 0; }

/* Points de confirmation avec halo lumineux */
.dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid var(--text-secondary);
    transition: all 0.3s ease;
}

.dot.filled {
    background: var(--gold-gradient); border-color: transparent;
    box-shadow: 0 0 10px rgba(197, 160, 89, 0.6);
    transform: scale(1.1);
}

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; max-width: 280px; margin: 0 auto; }

/* Boutons transparents et élégants */
.numpad button {
    height: 65px; border-radius: 32px;
    background-color: transparent; border: 1px solid rgba(142, 142, 147, 0.2);
    font-size: 26px; font-weight: 300; color: var(--text-color);
    cursor: pointer; transition: background-color 0.2s, transform 0.1s;
}

.numpad button:active { background-color: rgba(142, 142, 147, 0.15); transform: scale(0.95); }

.action-btn { font-size: 15px !important; border: none !important; color: var(--text-secondary) !important; font-weight: 400 !important; }

/* Animation d'erreur */
.error-shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* --- STYLES DU DASHBOARD --- */

.dashboard-body {
    display: block; /* Annule le display: flex du body de la page de login */
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 90px; /* Espace pour la bottom nav */
}

/* En-tête (Top Bar) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 50;
    border-bottom: 1px solid var(--glass-border);
}

.app-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-greeting {
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--gold-solid);
    border: 2px solid var(--gold-solid);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-family: 'Playfair Display', serif;
}

/* Contenu */
.content-area {
    padding: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Carte de Match */
.match-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.match-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.teams-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 40%;
}

.flag {
    font-size: 40px; /* On utilise des emojis pour l'instant, c'est léger et joli */
}

.team-name {
    font-size: 16px;
    font-weight: 600;
}

.vs {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(142, 142, 147, 0.1);
    padding: 5px 10px;
    border-radius: 10px;
}

/* Bouton Doré */
.gold-btn {
    width: 100%;
    padding: 15px;
    border-radius: 15px;
    background: var(--gold-gradient);
    color: #1C1C1E; /* Texte toujours foncé sur l'or pour la lisibilité */
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.3);
    transition: transform 0.2s;
}

.gold-btn:active {
    transform: scale(0.97);
}

/* --- NAVIGATION ALIGNÉE (Correction du menu central) --- */
/* 1. TA BARRE DE NAVIGATION (Ton code est bon, on le garde) */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 85px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: 20px;
    z-index: 1000; /* Elle est assez haute... */
}

/* 2. TA FENÊTRE DE PARI (Doit être encore plus haute) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end; /* La fenêtre part du bas */
    z-index: 9999; /* ...mais l'overlay est le roi, il passe devant tout ! */
}

.nav-item {
    flex: 1; /* Chaque menu prend exactement la même largeur */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-icon {
    font-size: 22px; /* Taille uniforme pour les emojis */
    height: 28px;    /* Boîte fixe pour que le texte soit aligné dessous */
    display: flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(100%);
    opacity: 0.5;
}

.nav-item.active {
    color: var(--gold-solid);
}

.nav-item.active .nav-icon {
    filter: grayscale(0%);
    opacity: 1;
}

/* --- OVERLAY ET BOTTOM SHEET (PANNEAU DE PARI) --- */

.modal-overlay.hidden {
    opacity: 0; pointer-events: none;
}

.bet-bottom-sheet {
    background: #1a1a1a;
    width: 100%;
    border-radius: 30px 30px 0 0;
    padding: 30px 25px;
    /* On ajoute une grosse marge en bas pour les iPhone récents (Safe Area) */
    padding-bottom: 60px; 
    box-sizing: border-box;
}

.modal-overlay.hidden .bet-bottom-sheet {
    transform: translateY(100%); /* Fait glisser vers le bas quand c'est caché */
}

/* En-tête du panneau */
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sheet-header h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--gold-solid); font-weight: 500;}
.close-btn { background: none; border: none; font-size: 22px; color: var(--text-secondary); cursor: pointer; padding: 5px; }

/* Récapitulatif du match */
.match-recap { text-align: center; font-size: 18px; font-weight: 600; margin-bottom: 25px; }
.vs-text { font-size: 13px; color: var(--text-secondary); margin: 0 15px; background: rgba(142,142,147,0.1); padding: 3px 8px; border-radius: 8px;}

/* Compteurs de score (+ et -) */
.score-selector { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 30px; }
.team-score { display: flex; align-items: center; gap: 15px; }
.score-btn { 
    width: 45px; height: 45px; border-radius: 50%; 
    border: 1px solid var(--glass-border); background: rgba(142,142,147,0.1); 
    color: var(--text-color); font-size: 24px; font-weight: 300; 
    cursor: pointer; transition: 0.2s; display: flex; justify-content: center; align-items: center;
}
.score-btn:active { background: rgba(142,142,147,0.2); transform: scale(0.9); }
.score-display { font-size: 38px; font-weight: 700; font-family: 'Playfair Display', serif; width: 35px; text-align: center; }
.score-divider { font-size: 24px; color: var(--text-secondary); font-weight: 300; }

/* Buteurs */
.scorers-section { margin-bottom: 30px; }
.scorers-section h4 { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
.scorer-input-group { display: flex; gap: 10px; margin-bottom: 15px; }
.scorer-input-group input { 
    flex: 1; padding: 15px; border-radius: 15px; 
    border: 1px solid var(--glass-border); background: rgba(142,142,147,0.05); 
    color: var(--text-color); font-size: 16px; outline: none; 
}
.scorer-input-group input:focus { border-color: var(--gold-solid); }
.add-btn { 
    width: 50px; border-radius: 15px; background: var(--gold-gradient); 
    border: none; font-size: 24px; color: #1C1C1E; cursor: pointer; transition: 0.2s;
}
.add-btn:active { transform: scale(0.95); }

/* Liste des buteurs */
.scorers-list { list-style: none; padding: 0; margin: 0; }
.scorers-list li { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 12px 15px; background: rgba(142,142,147,0.08); 
    border-radius: 12px; margin-bottom: 8px; font-size: 15px; font-weight: 500;
}
.remove-scorer { color: #FF453A; background: none; border: none; font-size: 20px; cursor: pointer; }

.leaderboard-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* On aligne tout le tableau à gauche par défaut */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    color: white;
}

/* --- SECTION MISE À JOUR POUR TES PARENTS (TEXTE PLUS GROS) --- */

/* Style de base des en-têtes */
.leaderboard-table th {
    color: #d4af37;
    padding-bottom: 20px; /* Espace augmenté */
    font-size: 0.95rem;    /* Titre un peu plus grand */
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Style des lignes du tableau */
.leaderboard-table td {
    padding: 18px 0;      /* Lignes beaucoup plus hautes et aérées */
    font-size: 1.15rem;    /* Noms et points bien plus gros pour la lecture */
    vertical-align: middle;
}

/* --- LA MAGIE DE L'ALIGNEMENT (ON NE TOUCHE PAS) --- */

/* 1. La colonne POS (chiffres/médailles) : alignée à gauche */
.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    text-align: left;
    width: 50px;
}

/* 2. La colonne PRENOM : alignée à gauche avec un peu d'espace */
.leaderboard-table th:nth-child(2),
.leaderboard-table td:nth-child(2) {
    text-align: left;
    padding-left: 10px;
}

/* 3. La colonne POINTS : TOUT à droite et bien aligné */
.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
    text-align: right;
    padding-right: 5px;
}

/* --- MÉDAILLES PLUS GROSSES --- */
.rank-1 { font-size: 1.6rem; } /* 🥇 */
.rank-2 { font-size: 1.4rem; } /* 🥈 */
.rank-3 { font-size: 1.3rem; } /* 🥉 */

/* Style pour les autres positions */
.rank-other { 
    font-family: sans-serif;
    color: rgba(255,255,255,0.4);
    font-weight: bold;
    font-size: 1.1rem; /* Chiffre 4, 5, 6 plus gros */
    padding-left: 5px;
}

/* Style spécial pour le dernier (épuré mais distinct) */
.last-place {
    background: rgba(255, 0, 0, 0.03); /* Très léger voile rouge */
    color: rgba(255, 255, 255, 0.3) !important;
}

.last-place td {
    border-bottom: none !important;
    font-style: italic;
}

/* --- RESTE DU CODE (INDISPENSABLE) --- */

.section-title.centered {
    text-align: center;
    width: 100%;
    margin-bottom: 25px;
    display: block;
}

.empty-msg {
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin-top: 40px;
    font-style: italic;
}

.hidden {
    display: none !important;
}