/* style.css (CORRIGÉ ET FINALISÉ) */

/* --- STYLES GÉNÉRAUX ET INFORMATIONS JOUEURS --- */

/* Bannière de Jeu */
header {
    background: linear-gradient(90deg, #131330, #2c2c54, #131330);
    color: #e0e0e0;
    padding: 20px 0;
    text-align: center;
    border-bottom: 3px solid gold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5em;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00, 0 0 5px #ffcc00;
    margin: 0;
    padding-bottom: 5px;
}

header p {
    font-size: 1.1em;
    color: #b0b0d0;
    margin: 0;
    padding-top: 5px;
}

body {
    font-family: Arial, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
}

.game-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #2c2c54;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.players-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.player-panel {
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: border-color 0.3s;
}

.active-player {
    border-color: gold; 
    box-shadow: 0 0 10px gold;
}

#game-status {
    text-align: center;
}

#message-log {
    min-height: 40px;
    font-weight: bold;
    color: lightblue;
    margin-top: 5px;
}

/* --- GRILLE ET STRUCTURE DES CARTES --- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); 
    gap: 15px;
    padding: 20px;
}

.card {
    width: 100%;
    height: 150px; 
    cursor: pointer;
    position: relative;
    border-radius: 8px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.card.used {
    pointer-events: none;
    opacity: 0.8; 
}

/* Les deux faces */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    /* Règle essentielle: utilise flex pour centrer le contenu interne (texte/?) */
    display: flex; 
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    border-radius: 8px;
    border: 3px solid #333;
    /* Assure que la face avant/arrière est bien gérée par la classe .face-cachée */
    backface-visibility: hidden; 
    transition: all 0.5s; 
}

/* Dos de la carte (Visible par défaut) */
.card-face.back {
    background-color: #4a77a8;
    color: white;
    font-size: 2em;
}

/* Face avant (Cachée par défaut) */
.card-face.front {
    background-color: #e6e6e6;
    color: #333;
    display: none; /* Cache par défaut (sera affiché par JS/règle suivante) */
}

/* --- LOGIQUE DE REMPLACEMENT INSTANTANÉE (MÉTHODE SIMPLE AVEC JS) --- */

.card:not(.face-cachée) .card-face.back {
    display: none; 
}

.card:not(.face-cachée) .card-face.front {
    display: flex; /* Affiche la face avant quand .face-cachée est retirée */
}


/* --- DÉFINITION DES IMAGES PAR POUVOIR --- */

.card-face.front {
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat;
    font-size: 0; 
}

.card[data-power-id="ATK_LASER"] .card-face.front {
    background-image: url('images/laser.png');
    border-color: red;
}

.card[data-power-id="DEF_BOUCLIER"] .card-face.front {
    background-image: url('images/bouclier.png');
    border-color: blue;
}

.card[data-power-id="DEF_REPARATION"] .card-face.front {
    background-image: url('images/reparation.png');
    border-color: green;
}

.card[data-power-id="ATK_DRONE"] .card-face.front {
    background-image: url('images/drone.png');
    border-color: orange;
}


/* ---------------------------------------------------------------------- */
/* --- STYLES DE LA MODALE DE QUESTION (CORRIGÉS ET AJOUTÉS) --- */
/* ---------------------------------------------------------------------- */

/* CORRECTION MAJEURE : Intégration des styles pour l'arrière-plan */
#question-modal {
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.7); 
    display: flex; /* ✅ AJOUT IMPORTANT: Utilise flex pour centrer le contenu */
    justify-content: center; /* Centrage horizontal */
    align-items: center; /* Centrage vertical */
}

/* Le contenu central de la modale */
#modal-content {
    background-color: #3b3b64;
    color: #e0e0e0;
    /* margin: 15% auto; <-- Supprimé car le flex ci-dessus s'en occupe mieux */
    padding: 30px;
    border: 3px solid #ffcc00;
    border-radius: 12px;
    width: 90%; 
    max-width: 450px; 
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.4);
    animation: fadeIn 0.3s ease-out; 
    /* Assure que le contenu n'est pas coupé par la taille du modal-content */
    box-sizing: border-box; 
}

/* Animation simple pour l'apparition */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Texte de la question */
#modal-question-text {
    font-size: 1.4em;
    font-weight: bold;
    color: #b0b0d0;
    margin-bottom: 25px;
}

/* Champ de saisie de la réponse */
#modal-answer-input {
    padding: 12px;
    margin: 15px 0 20px;
    width: 90%;
    border: 2px solid #5a5a8f;
    border-radius: 6px;
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-size: 1.1em;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#modal-answer-input:focus {
    border-color: #ffcc00;
    outline: none;
}

/* Bouton de validation (Succès) */
#modal-submit-button {
    padding: 12px 25px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s;
}

#modal-submit-button:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

/* Bouton d'annulation */
#modal-cancel-button {
    padding: 12px 25px;
    cursor: pointer;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    margin-left: 10px;
    transition: background-color 0.2s, transform 0.1s;
}

#modal-cancel-button:hover {
    background-color: #da190b;
    transform: translateY(-1px);
}