/* Fichier : css/yatzy.css */

/* 1. TYPOGRAPHIE ET FOND GÉNÉRAL */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    background-color: #f0f4f8; /* Gris très clair pour le fond de la page */
    color: #2c3e50;
    padding: 10px;
    margin: 0 auto;
    max-width: 1000px;
}

/* --- BANDEAU DE JEU FIXE (Positionnement par défaut: HAUT / Desktop) --- */
#game-controls-fixed {
    position: fixed;
    top: 0; /* FIXÉ EN HAUT (Desktop) */
    left: 0;
    width: 100%;
    background-color: #ffffff; /* Fond BLANC pour bien le détacher du body */
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

/* --- DÉS ET CONTRÔLES (Styles généraux) --- */
#dice-container {
    display: flex;
    justify-content: center;
    margin: 0 auto 10px auto;
    gap: 2vw;
    padding: 0 15vw; /* Grand padding pour centrer sur desktop */
}

.die {
    width: 16vw;
    height: 16vw;
    max-width: 70px;
    max-height: 70px;
    background-color: white;
    border: 3px solid #2c3e50;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    position: relative;
    flex-shrink: 0;
}

/* 🌟 EFFET DE GLOW BLEU POUR INCITER AU LANCER */
.die.glow-to-roll {
    /* Box-shadow bleu lumineux et bordure légèrement plus claire */
    box-shadow: 0 0 15px 5px rgba(0, 191, 255, 0.7), 0 0 5px rgba(0, 191, 255, 0.5) inset;
    border-color: #00bfff;
}


/* Centrage du '?' (Dé non lancé) */
.die.unrolled {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
}
.die:not(.unrolled) {
    position: relative;
    display: block;
}


/* Style pour le point (pip) */
.pip {
    width: 12px;
    height: 12px;
    background-color: black;
    border-radius: 50%;
    display: none;
    position: absolute;
    transition: opacity 0.1s;
}
/* Positions des points (inchangées) */
.pip-1 { top: 12%; left: 12%; }
.pip-2 { top: 12%; left: 50%; transform: translateX(-50%); }
.pip-3 { top: 12%; right: 12%; }
.pip-4 { top: 50%; left: 12%; transform: translateY(-50%); }
.pip-5 { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pip-6 { top: 50%; right: 12%; transform: translateY(-50%); }
.pip-7 { bottom: 12%; left: 12%; }
.pip-8 { bottom: 12%; left: 50%; transform: translateX(-50%); }
.pip-9 { bottom: 12%; right: 12%; }


/* Style des dés verrouillés (inchangé) */
.die:hover {
    transform: scale(1.05);
}
.locked {
    background-color: #f7d794;
    border-color: #e67e22;
    box-shadow: 0 0 10px rgba(230, 126, 34, 0.7);
}

/* ---------------------------------------------------- */
/* --- AFFICHAGE DES POINTS SELON LA VALEUR DU DÉ (1 à 6) --- */

.die-value-1 .pip-5 { display: block; }
.die-value-2 .pip-1, .die-value-2 .pip-9 { display: block; }
.die-value-3 .pip-1, .die-value-3 .pip-5, .die-value-3 .pip-9 { display: block; }
.die-value-4 .pip-1, .die-value-4 .pip-3, .die-value-4 .pip-7, .die-value-4 .pip-9 { display: block; }
.die-value-5 .pip-1, .die-value-5 .pip-3, .die-value-5 .pip-5, .die-value-5 .pip-7, .die-value-5 .pip-9 { display: block; }
.die-value-6 .pip-1, .die-value-6 .pip-3, .die-value-6 .pip-4, .die-value-6 .pip-6, .die-value-6 .pip-7, .die-value-6 .pip-9 { display: block; }


/* --- ANIMATION DE SCRAMBLE (Complet) --- */
@keyframes scrambleShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-1px, -1px); }
    30% { transform: translate(1px, 1px); }
    50% { transform: translate(-0.5px, 0.5px); }
    70% { transform: translate(0.5px, -0.5px); }
    90% { transform: translate(-1px, 1px); }
}

.die.scramble-roll {
    animation-name: scrambleShake;
    animation-duration: 0.2s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}


/* --- CONTRÔLES (Bouton et Décompte) --- */

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
}

#roll-button {
    /* Ajout du display flex pour aligner les enfants verticalement */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding: 10px 25px; /* Ajuster légèrement le padding pour contenir le texte */
    font-size: 18px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px #1e8449;
    transition: all 0.1s;
}
#roll-button:active {
    box-shadow: 0 2px #1e8449;
    transform: translateY(2px);
}

/* Conteneur pour le texte "Lancés restants" */
#rolls-counter-display {
    font-size: 0.7em; /* Rendre le texte plus petit */
    color: rgba(255, 255, 255, 0.8); /* Couleur plus claire pour contraster */
    margin-top: 3px; /* Petit espace sous le texte principal */
    line-height: 1;
}

/* Maintient le texte des lancers restants en blanc et gras à l'intérieur du bouton */
#roll-button #rolls-left {
    font-weight: bold;
    color: white;
}
/* Le style du texte principal (#roll-button-text) hérite du style du bouton */


button:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

/* --- STYLE DU BOUTON ABANDONNER --- */

#abandon-button {
    padding: 8px 15px;
    font-size: 14px;
    background-color: #e74c3c; /* Rouge pour l'abandon */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 3px #c0392b;
    transition: all 0.1s;
    margin-top: 10px;
}
#abandon-button:active {
    box-shadow: 0 1px #c0392b;
    transform: translateY(2px);
}


/* --- Styles de Fiche de Score (Bordures Restaurées) --- */

#score-card-container {
    display: flex;
    justify-content: center;
    padding: 0 10px;
}
#score-card {
    width: 100%;
    max-width: 500px;
    border-collapse: collapse;
    text-align: left;
    background-color: white;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease-out;
}
#score-card th, #score-card td {
    border: 1px solid #ecf0f1;
    padding: 8px;
    height: 40px;
    line-height: 40px;
    vertical-align: middle;
    display: table-cell;
}
#score-card th {
    background-color: #ecf0f1;
    font-weight: 600;
    padding: 12px 8px;
    height: auto;
    line-height: normal;
}

.score-box { text-align: center; width: 60px; }

/* 1. Ligne utilisée et notée (Score > 0) */
.score-box.used {
    background-color: #d4efdf; /* Vert clair */
    font-weight: bold;
    color: #1abc9c;
}

/* 2. Ligne utilisée et BARRÉE (Score = 0) */
.score-box.traced {
    background-color: #f0f0f0; /* Gris très clair pour 'tracée' */
    font-weight: normal;
    color: #95a5a6; /* Gris moyen pour le texte barré */
    text-decoration: line-through; /* Souligne pour indiquer que la catégorie est perdue */
}

.section-title { background-color: #a3e6a3 !important; text-align: center; font-weight: bold !important; }
#score-card tfoot td:last-child { font-size: 1.2em; font-weight: bold; background-color: #34495e; color: white; }

.score-box button {
    background-color: #3498db;
    color: white;
    padding: 8px 4px;
    font-size: 13px;
    width: 100%;
    max-width: 80px;
    border-radius: 4px;
    box-shadow: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}
.score-box button:hover { background-color: #2980b9; }

.score-box .barrer-button { background-color: #e67e22; }
.score-box .barrer-button:hover { background-color: #d35400; }

.subtotal-row td, .bonus-row td {
    background-color: #f7f9fa;
    font-weight: 500;
    height: 40px;
    line-height: 40px;
}
.total-section-row td {
    background-color: #d4efdf;
    font-weight: bold;
    border-top: 2px solid #27ae60 !important;
    height: 40px;
    line-height: 40px;
}

/* --- COULEUR SPÉCIFIQUE POUR LE BOUTON REJOUER (MODIFIÉ EN BLEU) --- */

#roll-button[aria-label="Rejouer"] {
    background-color: #3498db; /* Nouveau bleu (standard) */
    box-shadow: 0 4px #2980b9; /* Nouveau bleu foncé pour l'ombre */
}
#roll-button[aria-label="Rejouer"]:hover {
    background-color: #2980b9; /* Nouveau bleu foncé au survol */
}
#roll-button[aria-label="Rejouer"]:active {
    box-shadow: 0 2px #2980b9;
    transform: translateY(2px);
}

/* --- AJOUTS POUR LE MEILLEUR SCORE --- */

#high-score-row {
    background-color: #f7e0e0;
    font-weight: bold;
    font-size: 1.1em;
    border-top: 3px solid #e74c3c;
    border-bottom: 2px solid #e74c3c;
}

#high-score-row td {
    height: 50px;
    line-height: 50px;
    padding: 0 10px;
}

#high-score-row #high-score-value {
    color: #e74c3c;
    font-size: 1.2em;
}

#high-score-row .score-box {
    text-align: center;
}


/* ---------------------------------------------------- */
/* --- MEDIA QUERY : ADAPTATION MOBILE/TABLETTE (< 1024px) --- */
/* ---------------------------------------------------- */

@media (max-width: 1024px) {

    /* 🌟 DÉPLACEMENT DU BANDEAU VERS LE BAS 🌟 */
    #game-controls-fixed {
        top: auto;
        bottom: 0;        /* FIXE EN BAS */
        padding-top: 10px;
        padding-bottom: 30px;
        box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.15); /* Ombre projetée vers le haut */
    }

    /* Ajustement des dés pour le mobile */
    #dice-container {
        padding: 0 5vw;
        gap: 1.5vw;
    }

    .die {
        width: 16vw;
        height: 16vw;
        max-width: 70px;
        max-height: 70px;
    }
}


/* --- Media Queries (Améliorations Desktop >= 768px) --- */
@media (min-width: 768px) {
    /* Assure la taille des dés sur desktop */
    .die { width: 80px; height: 80px; }
    .pip { width: 14px; height: 14px; }
    .score-box button { max-width: 100px; }
}


/* ---------------------------------------------------- */
/* --- NOTIFICATIONS PERSONNALISÉES (Modal) --- */
/* ---------------------------------------------------- */

#custom-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

#custom-notification-overlay.hidden {
    display: none;
    opacity: 0;
}

#custom-notification-box {
    background-color: white;
    color: #2c3e50;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    max-width: 90%;
    width: 350px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.3s ease-in-out;
}

#notification-title {
    font-size: 1.6em;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 700;
}

#notification-message {
    font-size: 1.1em;
    margin-bottom: 25px;
    line-height: 1.4;
}

/* Conteneur des boutons de notification */
#notification-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    /* Rendre le conteneur visible en mode slider pour afficher le bouton ANNULER */
    display: flex;
}

#notification-buttons button {
    flex-grow: 1;
    padding: 10px 25px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 3px rgba(0, 0, 0, 0.2);
    /* CORRECTION: Force la couleur du texte en blanc pour tous les boutons de la modale */
    color: white;
}
#notification-buttons button:active {
    box-shadow: 0 1px rgba(0, 0, 0, 0.2);
    transform: translateY(2px);
}


/* --- Styles par type de notification --- */

/* Type: Success/Bonus (Vert du jeu) */
#custom-notification-box.success #notification-title {
    color: #27ae60;
}
#custom-notification-box.success #notification-close-button {
    background-color: #27ae60;
    color: white;
}
#custom-notification-box.success #notification-close-button:hover {
    background-color: #1e8449;
}

/* Type: Warning/Rolls Exhausted (Orange du bouton barrer) */
#custom-notification-box.warning #notification-title {
    color: #e67e22;
}
#custom-notification-box.warning #notification-close-button {
    background-color: #e67e22;
    color: white;
}
#custom-notification-box.warning #notification-close-button:hover {
    background-color: #d35400;
}

/* Type: Info/Normal (Bleu des boutons valider) */
#custom-notification-box.info #notification-title {
    color: #3498db;
}
#custom-notification-box.info #notification-close-button {
    background-color: #3498db;
    color: white;
}
#custom-notification-box.info #notification-close-button:hover {
    background-color: #2980b9;
}


/* ---------------------------------------------------- */
/* --- STYLES DU SLIDER DE CONFIRMATION --- */
/* ---------------------------------------------------- */

#confirmation-slider-container {
    padding: 10px 0;
}

#slider-label {
    font-size: 0.9em;
    color: #34495e;
    margin-bottom: 8px;
    font-weight: 600;
}

#confirmation-slider {
    position: relative;
    height: 40px;
    background-color: #ecf0f1; /* Gris clair pour la piste */
    border-radius: 8px;
    margin: 10px 0 20px 0;
    overflow: hidden;
    cursor: default;
}

#slider-text {
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.2em;
    pointer-events: none;
    transition: opacity 0.3s;
    letter-spacing: 1px;
}

#slider-handle {
    width: 20%;
    height: 100%;
    background-color: #e74c3c; /* Rouge de danger */
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    transition: left 0.15s ease-out, background-color 0.1s, box-shadow 0.3s; /* Transition réactivée */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

#slider-handle:active {
    cursor: grabbing;
    background-color: #c0392b;
}

/* Masquer le bouton OK standard si la modale est en mode slider */
#custom-notification-box.slider-mode #notification-close-button {
    display: none !important;
}

/* Assurer le style du bouton Annuler en mode slider */
#custom-notification-box.slider-mode #notification-cancel-button {
    display: block !important;
    width: 100%;
    flex-grow: 1;
}

/* ---------------------------------------------------- */
/* --- NOUVEAU: STYLES POUR LES FEUX D'ARTIFICE (MIS À JOUR) --- */
/* ---------------------------------------------------- */

#fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    /* Empêche les feux d'artifice de bloquer les clics sur le jeu */
    pointer-events: none;
}

/* Le conteneur des particules (point d'explosion) */
.firework {
    position: absolute;
    /* Le JS définit sa position et sa couleur */
}

/* Les particules de l'explosion */
.firework-particle {
    position: absolute;
    width: 4px; /* Augmenté de 3px à 4px */
    height: 4px; /* Augmenté de 3px à 4px */
    border-radius: 50%;
    /* Transition plus longue pour un effet plus lent et durable */
    transition: transform 2s ease-out, opacity 2s ease-out; /* Augmenté de 1s à 2s */
    display: block; /* S'assurer qu'elles sont rendues comme des boîtes */
}
