/* ==========================================================================
   CONFIGURATION DE BASE ET TYPOGRAPHIE
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Empêche le scroll global qui tronque les éléments */
    background-color: #000;
}

.timer-page-body {
    margin-top: 0 !important;
    height: 100vh !important;
    width: 100vw;
    color: white;
    font-family: 'Arial', sans-serif;
    background: radial-gradient(circle, #1a1a1a 0%, #000000 100%);
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.main-layout-container {
    display: flex;
    width: 100vw;
    height: 100%; 
    overflow: hidden;
    box-sizing: border-box;
}

/* Sidebar Leaderboard */
.leaderboard-sidebar {
    width: 300px;
    background: rgba(0, 0, 0, 0.4);
    border-right: 2px solid #333;
    display: flex;
    flex-direction: column;
    z-index: 5;
}

.sidebar-header {
    background: #1a1a1a;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    color: #f1c40f;
    border-bottom: 2px solid #333;
    font-size: 1.2rem;
    text-transform: uppercase;
}

/*
.scroll-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.scroll-content {
    display: flex;
    flex-direction: column;
    padding: 10px;
}
*/
.scroll-container {
    overflow: hidden; /* Cache ce qui dépasse */
    height: 100%;    /* Ou une hauteur fixe */
}

.scroll-content {
    display: flex;
    flex-direction: column;
}

.ranking-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #e74c3c;
    border-radius: 4px;
    font-size: 1.2rem;
}

.rank-col { width: 45px; font-weight: bold; color: #f1c40f; font-size: 1.4rem; }
.name-col { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #eee; }
.pts-col { color: #32d9fa; justify-content: right; }
.kills-col { font-size: 1rem; color: #888; }

/* ==========================================================================
   STRUCTURE DU TIMER
   ========================================================================== */
.timer-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    box-sizing: border-box;
    position: relative;
}

/* .timer-header / .level-number / .stats-bar — anciens sélecteurs supprimés
   en mai 2026 lors du passage au layout TV (cf. assets/css/view-timer.css). */

.timer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* .blinds / .ante / .clock-display — anciennes classes du layout legacy.
   Le nouveau layout TV utilise .tv-blinds / .tv-ante / .tv-clock. Ces règles
   restent en place uniquement pour le mode "table finale" (poker-table).  */
.blinds { font-size: 11vw; line-height: 1; color: #fff; font-weight: bold; }
.ante { font-size: clamp(2rem, 5vw, 4rem); color: #27ae60; margin-top: 10px; }
.clock-display { font-weight: bold; transition: color 0.3s ease; }

.clock-display.paused {
    color: #e74c3c !important;
    animation: blinker 1.5s linear infinite;
}

/* .timer-footer — supprimé (remplacé par .tv-footer dans view-timer.css). */

/* ==========================================================================
   NAVIGATION & OVERLAYS (CORRECTIFS TRONQUAGE)
   ========================================================================== */
header, .navbar, .main-nav {
    position: fixed !important;
    top: 0; left: 0; width: 100%;
    z-index: 20000 !important;
    transition: transform 0.4s ease;
    transform: translateY(-100%);
    box-sizing: border-box;
    padding-right: 30px !important; /* Evite que Déconnexion soit collé à droite */
}

body.show-nav header, body.show-nav .navbar, body.show-nav .main-nav { transform: translateY(0) !important; }
body.hide-cursor { cursor: none; }

/* Bloc Boutons Admin - Sécurité pour éviter le tronquage */
.td-overlay {
    position: fixed !important;
    bottom: 50px !important; /* Remonté pour ne pas être coupé en bas */
    right: 50px !important;  /* Décalé pour ne pas être coupé à droite */
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 20px;
    border: 2px solid #444;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 10001;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.4s ease;
    box-sizing: border-box;
}

body.show-nav .td-overlay { opacity: 1; transform: translateY(0); pointer-events: auto; }

.ctrl-group { display: flex; gap: 15px; }
.ctrl-btn {
    background: #222; color: white; border: 1px solid #444;
    width: 80px; height: 80px; border-radius: 15px;
    cursor: pointer; font-size: 2.2rem;
    display: flex; align-items: center; justify-content: center;
}

.btn-play { color: #2ecc71; }
.btn-pause { color: #e74c3c; }

/* .timer-top-overlay — supprimé (l'horloge murale + nom + stats vivent
   désormais dans .tv-header / .tv-footer). */

/* ==========================================================================
   RESPONSIVE & BURGER (CORRECTIFS)
   ========================================================================== */
@media (max-width: 1023px) {
    .leaderboard-sidebar { display: none !important; }
    .timer-wrapper { width: 100vw !important; flex: none; }
}

@media (max-width: 992px) {
    .timer-page-body { height: 100vh; }
    
    /* On force l'apparition et le positionnement du burger */
    .menu-toggle, .navbar-toggler, .burger-menu, .fa-bars {
        display: block !important;
        position: absolute !important;
        right: 40px !important; /* Poussé vers la gauche pour ne pas être tronqué */
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 100003 !important;
        color: white !important;
        padding: 10px;
    }

    .nav-list, .navbar-nav { display: none !important; }

    header .container, .navbar-container {
        width: 100%;
        padding-right: 50px !important;
        position: relative;
    }
    
    .td-overlay {
        bottom: 30px !important;
        right: 30px !important;
        transform: scale(0.85); /* Un peu plus petit sur tablette/mobile */
    }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes scrollLeaderboard {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); } /* On s'arrête à la moitié car le contenu est doublé */
}

@keyframes blinker { 50% { opacity: 0.3; } }
@keyframes pulse-yellow { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.break-text { font-weight: bold; color: #f1c40f; letter-spacing: 5px; animation: pulse-yellow 2s infinite; }

:fullscreen .td-overlay {
    bottom: 10px; /* On remonte un peu les contrôles en plein écran */
}

/* Optionnel : cacher le curseur de la souris en plein écran s'il ne bouge pas */
:fullscreen {
    cursor: none;
}

/* Style des messages de structure spéciaux */
.special-info-container {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #f1c40f;
    display: inline-block;
    min-width: 300px;
}

.special-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #f1c40f;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1;
}

.special-description {
    font-size: 1.1rem;
    color: #bdc3c7;
    font-style: italic;
    margin-top: 5px;
}

/* Animation de pulsation si c'est une pause avec titre */
.timer-main .break-text {
    animation: pulsePause 2s infinite;
}

@keyframes pulsePause {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Cache le curseur sur tout le corps de la page */
.hide-cursor {
    cursor: none !important;
}

/* Optionnel : on peut aussi masquer la barre de défilement pour un look "TV" */
body::-webkit-scrollbar {
    display: none;
}
body {
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow: hidden; /* Empêche le scroll manuel sur l'écran géant */
}
.winner-text {
    color: #f1c40f;
    font-size: 1.2em;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
    animation: celebrate 1s ease-in-out infinite alternate;
}

.winner-name {
    font-size: 4rem;
    color: white;
    font-weight: 900;
    margin-top: 20px;
}

@keyframes celebrate {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}
.poker-table {
    position: relative;
    width: 800px;
    height: 400px;
    background: radial-gradient(circle, #27ae60 0%, #1e8449 100%);
    border: 15px solid #34495e; 
    border-radius: 200px;
    margin: 80px auto; /* Un peu plus de marge pour les noms qui dépassent */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.play-center-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #f1c40f;
    border: 4px solid #fff;
    color: #1a1a1a;
    font-weight: 900;
    cursor: pointer;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
    transition: transform 0.2s;
}

.play-center-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.seat-slot {
    position: absolute;
    top: 50%;
    left: 50%;
    /* On définit les rayons de l'ovale ici */
    --rx: 430px; /* Rayon horizontal (largeur table / 2 + marge) */
    --ry: 230px; /* Rayon vertical (hauteur table / 2 + marge) */
    
    /* La formule magique pour l'ovale : cos pour X, sin pour Y */
    transform: translate(
        calc(-50% + (cos(var(--angle)) * var(--rx))),
        calc(-50% + (sin(var(--angle)) * var(--ry)))
    );
}

.seat-info {
    background: rgba(0,0,0,0.9);
    padding: 8px 12px;
    border-radius: 8px;
    color: white;
    min-width: 120px;
    text-align: center;
    border: 2px solid #f1c40f;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.seat-num { 
    display: block; 
    font-size: 0.7rem; 
    color: #f1c40f; 
    border-bottom: 1px solid #444;
    margin-bottom: 4px;
}

.player-name { 
    font-weight: bold; 
    font-size: 1rem; 
    white-space: nowrap;
}

@keyframes seatPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.seat-pop {
    animation: seatPop 0.4s ease-out;
}
/* ==========================================================================
   OVERLAY TABLE FINALE (MESSAGE CLIGNOTANT)
   ========================================================================== */
.tf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5; /* Moins élevé que l'td-overlay (10001) */
    text-align: center;
    pointer-events: none; /* TRÈS IMPORTANT : permet de cliquer "à travers" l'overlay */
}

.tf-content h2 {
    font-size: 6rem;
    color: #f1c40f;
    text-shadow: 0 0 30px rgba(241, 196, 15, 0.5);
    margin-bottom: 20px;
    animation: blinker 1s linear infinite;
}

.tf-content p {
    font-size: 2.5rem;
    color: white;
}

/* Ajustement pour le miroir du chrono sur la TF */
#tf-countdown-mirror {
    pointer-events: none; /* Le chrono ne doit pas bloquer le clic sur le bouton Play */
}
.table-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 300px;
    pointer-events: none; /* L'admin peut cliquer à travers sur le fond de la table */
    z-index: 1;
}

.center-blinds-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.center-blinds-values {
    font-size: 2.0rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin: 5px 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.center-ante-label {
    font-size: 1.2rem;
    color: #2ecc71;
    font-weight: bold;
}

.table-logo-decoration {
    margin-top: 15px;
    font-size: 0.8rem;
    color: #f1c40f;
    border-top: 1px solid rgba(241, 196, 15, 0.3);
    padding-top: 10px;
    letter-spacing: 5px;
    opacity: 0.8;
}
/* Style du bandeau d'alerte réseau */
#offline-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    font-family: sans-serif;
    animation: slideDown 0.5s ease-out;
}

/* Effet sur le timer en cas de déconnexion */
body.is-offline .clock-display {
    opacity: 0.6;
    filter: grayscale(1);
    transition: all 0.5s ease;
}

/* Optionnel : Une petite pulsation pour montrer qu'on cherche la connexion */
body.is-offline #offline-alert {
    animation: pulseRed 2s infinite;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes pulseRed {
    0% { background-color: #e74c3c; }
    50% { background-color: #c0392b; }
    100% { background-color: #e74c3c; }
}
@media (max-width: 768px) {
    /* On cache le conteneur du plan de table ovale */
    .poker-table-container {
        display: none; 
    }

    /* On affiche une version liste pour mobile (à créer dans le HTML) */
    .mobile-tf-list {
        display: block;
        width: 95%;
        margin: 10px auto;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 10px;
        padding: 10px;
    }

    .mobile-seat-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-seat-number {
        background: #f1c40f;
        color: #000;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 0.8rem;
    }

    .mobile-player-name {
        flex-grow: 1;
        margin-left: 15px;
        color: white;
        font-size: 1rem;
    }
}

/* On cache la liste mobile sur ordinateur */
@media (min-width: 769px) {
    .mobile-tf-list { display: none; }
}
/* --- CONFIGURATION PAR DÉFAUT (Ordinateur / Écran large) --- */
.poker-table-container {
    display: block; /* On montre la table ovale */
}

.mobile-tf-list {
    display: none; /* On cache la liste */
}

/* --- CONFIGURATION MOBILE (Écrans inférieurs à 768px) --- */
@media (max-width: 768px) {
    .poker-table-container {
        display: none !important; /* On cache la table ovale */
    }

    .mobile-tf-list {
        display: block !important; /* On montre la liste verticale */
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    /* Optionnel : Ajuster la taille du titre de la TF sur mobile */
    .tf-section-title {
        font-size: 1.2rem;
        margin-top: 20px;
    }
}
/* ==========================================================================
   OPTIMISATION DES BOUTONS DE CONTRÔLE (Overlay bas)
   ========================================================================== */

/* Conteneur des boutons Gérer et Actions TD */
.td-overlay .time-adjusters {
    display: flex !important;
    justify-content: center !important;
    gap: 15px !important; /* Espacement entre les deux boutons */
    margin-top: 15px !important;
}

/* Style des boutons (Gérer, Actions TD, +1m, -1m) */
.td-overlay .btn-small {
    /* On force une taille tactile confortable */
    min-height: 50px !important;
    min-width: 140px !important;
    
    /* Alignement du contenu */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* Style visuel */
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    border: none !important;
    
    /* On annule les marges manuelles du PHP pour laisser le GAP gérer l'espace */
    margin-right: 0 !important; 
    margin-top: 0 !important;
}

/* Spécificité pour Actions TD (Orange) pour qu'il ne soit pas trop serré */
.td-overlay a[href*="td-actions.php"] {
    background-color: #e67e22 !important;
    min-width: 180px !important; /* Un peu plus large car le texte est long */
}

/* Spécificité pour Gérer (Bleu) */
.td-overlay a[href*="admin-tournament-manage.php"] {
    background-color: #2980b9 !important;
}

/* Effet tactile : le bouton s'enfonce quand on appuie dessus */
.td-overlay .btn-small:active {
    transform: scale(0.95) !important;
    filter: brightness(1.2);
}
