/* Conteneur principal pour le jeu de cartes */
#card-game-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
}

/* Styles généraux pour les cartes */
#cards-container .cardGame {
    width: 20%;
    min-width: 130px;
    aspect-ratio: 0.75;
    cursor: pointer;
    perspective: 1000px;
    /* Cette propriété permet de voir l'effet de profondeur lors de la rotation */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 15px;
}

/* Effet de survol pour l'animation des cartes */
#cards-container .cardGame:hover {
    transform: scale(1.05);
}

#cards-container .cardGame:hover .card-inner {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* Structure de la carte (avant et arrière) */
.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    /* Nécessaire pour appliquer l'effet de rotation */
    transition: transform 0.5s, box-shadow 0.2s ease;
    /* Animation de la rotation */
    border-radius: 8px;
}

/* Animation de rotation */
.cardGame .card-inner.flipped {
    transform: rotateY(180deg);
    /* Retourne la carte de 180° sur l'axe Y */
}

.cardGame .card-inner.flipped .card-back {
    box-shadow: 0 0px 10px #444 inset, 0 0px 10px #336A43;
}

.cardGame:hover .card-inner {
    transform: rotateY(180deg);
    /* Retourne la carte de 180° sur l'axe Y */
}

/* Faces des cartes */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    /* Cache l'arrière de la carte lors de la rotation */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    color: white;
    font-weight: bold;
    border-radius: 10px;
    transition: 0.3s;
}

/* Style avant de la carte */
.card-front {
    background: var(--dark-color);
    background-size: cover;
    align-items: end;
    justify-content: stretch;

    p {
        padding: 15px;
        background: var(--dark-color);
        color: white;
        margin: 0;
        border-radius: 0 0 10px 10px;
        width: 100%;

    }
}

/* Style arrière de la carte */
.card-back {
    background: var(--red-color);
    background-image: url("../images/bg-white-alpha-xyAW5wl.svg");
    background-repeat: no-repeat;
    background-position: left bottom;
    background-size: 75%;
    transform: rotateY(180deg);
    /* Déclenche la rotation de l'arrière de la carte */
    font-size: 0.8rem;
    font-weight: normal;
    flex-direction: column;
    padding: 15px;
}

/* Style des cases à cocher */
.card-checkbox {
    margin-top: 10px;
}

/* Conteneur de cartes (affichage en grille) */
#cards-container {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    user-select: none;
}

/* Texte du compteur */
#compteur {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

#compteur-wrapper {
    position: sticky;
    top: 20px;
    z-index: 1;
    background: var(--dark-color);
    padding: 10px;
    border-radius: 5px;
    text-align: end;
    color: white;
}

.cardGame-checkbox {
    display: none;
}

/* Bouton suivant */
#suivant-btn {
    filter: grayscale(100);
    transition: all 0.3s;
    margin-top: 20px;
    position: relative;
    bottom: 20px;
    width: 100%;
}

#suivant-btn.active {
    filter: grayscale(0);
}

/* Conteneur des cartes de confirmation */
#cards-confirm-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Ajustement de la taille des cartes pour l'écran de confirmation */
#cards-confirm-container .cardGame {
    width: 18%;
    min-width: 160px;
    aspect-ratio: 0.75;
    cursor: default;
    perspective: 1000px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Animation au survol */
#cards-confirm-container .cardGame:hover {
    transform: scale(1.1);
}

/* Carte toujours retournable pour relire la description */
#cards-confirm-container .cardGame .card-inner {
    transform-style: preserve-3d;
    transition: transform 0.5s;
    border-radius: 8px;
}

/* Effet de flip au survol */
#cards-confirm-container .cardGame:hover .card-inner {
    transform: rotateY(180deg);
}

/* Désactiver le flip pour les cartes avec la classe no-flip */
.no-flip .cardGame:hover .card-inner {
    transform: none !important;
}

.no-flip .cardGame {
    cursor: default;
}

/* Ajustement pour les petits écrans */
@media (max-width: 768px) {
    #cards-container .cardGame {
        width: 100%;
    }

    #compteur-wrapper {
        align-self: flex-start;
        margin-left: auto;
    }

    #cards-confirm-container .cardGame {
        width: 45%;
    }
}

@media (max-width: 480px) {
    #cards-confirm-container .cardGame {
        width: 90%;
    }
}