/* screens.css - Styles spécifiques aux différents écrans */

/*--------- Écran d'accueil (home-screen) ---------*/
.logo-container {
    text-align: center;
    position: relative;
    margin-top: 1.5rem;
}

.logo {
    width: 180px;
    margin-bottom: 0.5rem;
    transition: transform 0.5s ease-in-out;
}

.logo:hover {
    transform: rotate(5deg);
}

.title-container {
    text-align: center;
    margin-bottom: 0.5rem;
}

.checkbox-group {
    margin: 1.5rem 0;
}

.resume-game {
    /* margin-top: 1.5rem; */
    padding-top: 0.5rem;
    /* border-top: 1px solid var(--color-separator); */
    display: none; /* Masqué par défaut */
}

/*--------- Écran des joueurs (players-screen) ---------*/
.player-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.player-form input {
    flex: 1;
}

.player-count {
    text-align: center;
    margin: 1rem 0;
    font-size: 1.1rem;
    color: var(--color-secondary);
}

.player-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-main) var(--color-bg-main);
}

.player-list::-webkit-scrollbar {
    width: 8px;
}

.player-list::-webkit-scrollbar-track {
    background: var(--color-bg-main);
    border-radius: 10px;
}

.player-list::-webkit-scrollbar-thumb {
    background-color: var(--color-primary);
    border-radius: 10px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid rgba(216, 212, 192, 0.2);
    transition: background-color 0.2s;
}

.player-item:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.player-item:last-child {
    border-bottom: none;
}

.player-name {
    font-size: 1.1rem;
    font-weight: 500;
}

.player-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-form {
    display: flex;
    width: 100%;
    gap: 0.5rem;
}

.edit-form input {
    flex: 1;
}


/*--------- Structure pour les écrans de paris et résultats ---------*/
#bets-screen .container,
#results-screen .container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* remplace height: 100vh */
    height: calc(var(--vh, 1vh) * 100); /* Hauteur précise basée sur le viewport réel */
    max-height: -webkit-fill-available; /* pour iOS Safari */
    padding: 0;
}

#bets-screen .container,
#results-screen .container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Fallback */
    height: calc(var(--vh, 1vh) * 100); /* Hauteur précise basée sur le viewport réel */
    padding: 0;
}

/* En-tête fixe */
#bets-screen h1,
#results-screen h1 {
    position: sticky;
    top: 0;
    background-color: var(--color-bg-main);
    padding: 0.8rem 1rem 0.5rem;
    margin: 0;
    z-index: 10;
    width: 100%;
}

/* Modification du style du message de validation */
#validation-message {
    border: none;
    position: sticky;
    top: 3.2rem; /* Légèrement ajusté */
    margin: 0.4rem 1rem 0.6rem; /* Légèrement réduit */
    padding: 0.6rem 1rem;
    background-color: var(--color-bg-card); /* Couleur par défaut = couleur des cartes */
    color: var(--color-text);
    border-radius: 8px;
    text-align: center;
    width: calc(100% - 2rem);
    font-size: 1.2rem;
    animation: fadeIn 0.3s ease-in-out;
    z-index: 11;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease; /* Animation douce lors du changement de couleur */
}

/* Style quand le total est incorrect */
#validation-message.warning {
    background-color: var(--color-alert);
}

/* Style quand le total est correct */
#validation-message.valid {
    background-color: var(--color-positive);
}

/* Zone défilante pour les cartes des joueurs ET la légende */
#bets-players-container,
#results-players-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
    width: 100%;
    min-height: 0; /* permet la contraction */
    /* scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--color-bg-main); */
}

/* Inclure la légende dans la zone défilante */
#results-players-container {
    display: flex;
    flex-direction: column;
}

#bets-players-container::-webkit-scrollbar,
#results-players-container::-webkit-scrollbar {
    width: 8px;
}

#bets-players-container::-webkit-scrollbar-track,
#results-players-container::-webkit-scrollbar-track {
    background: var(--color-bg-main);
    border-radius: 10px;
}

#bets-players-container::-webkit-scrollbar-thumb,
#results-players-container::-webkit-scrollbar-thumb {
    background-color: var(--color-primary);
    border-radius: 10px;
}

/* Boutons fixes en bas */
#bets-screen .btn-container,
#results-screen .btn-container {
    position: sticky;
    bottom: 0;
    background-color: var(--color-bg-main);
    padding: 0.8rem 1rem; /* Légèrement réduit */
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
    width: 100%;
    z-index: 10;
    margin-top: auto; /* Pour pousser vers le bas quand il y a peu de contenu */
}

/* Ajuster la taille des boutons sur les petits écrans pour économiser de l'espace */
@media (max-height: 600px) {
    #bets-screen .btn-container,
    #results-screen .btn-container {
        padding: 0.6rem 1rem;
    }
    
    #bets-screen .btn,
    #results-screen .btn {
        padding: 0.6rem 1.2rem;
    }
}

/*--------- Écran des manches (rounds-screen) ---------*/

/* Correctif pour les cartes de joueurs */
body #bets-players-container .player-card,
body #results-players-container .player-card {
    width: 100% !important;
    box-sizing: border-box !important;
}

#bets-players-container,
#results-players-container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Solution alternative utilisant la nouvelle unité dvh (dynamic viewport height) 
   pour les navigateurs qui la supportent */
   @supports (height: 100dvh) {
    #bets-screen .container,
    #results-screen .container {
        min-height: 100dvh;
        height: 100dvh;
    }
}

/*--------- Écran des paris (bets-screen) ---------*/

.player-card {
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
    transition: all 0.3s;
}

.player-card.has-bet {
    border-left: 4px solid var(--color-positive);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
}

.player-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.player-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-secondary);
}

/*--------- Écran des résultats (results-screen) ---------*/
.round-badge {
    background-color: var(--color-accent);
    color: var(--color-text);
    font-family: 'IM Fell English', serif;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.player-card.completed {
    border-left: 4px solid var(--color-positive);
}

.player-bet {
    text-align: center;
    font-size: 1rem;
}

.bet-value {
    font-weight: bold;
    color: var(--color-secondary);
    font-size: 1.2rem;
}

.fold-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-main) transparent;
}

.fold-buttons::-webkit-scrollbar {
    height: 1px;
}

.fold-buttons::-webkit-scrollbar-track {
    background: transparent;
}

.fold-buttons::-webkit-scrollbar-thumb {
    background-color: var(--color-bg-main);
    border-radius: 1px;
}

.bonus-score-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.player-round-score {
    font-size: 1rem;
    white-space: nowrap;
    margin-left: auto;
}

/* Style pour la légende des bonus */
.bonus-legend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 0.3rem 0;
    padding: 0.5rem 0;
    width: 100%;
    margin-top: auto; /* Pousse la légende vers le bas de la zone défilante */
    margin-bottom: 1rem;
}

.bonus-legend-item {
    display: flex;
    align-items: center;
    color: var(--color-secondary);
    opacity: 0.8;
    font-size: 1rem;
}

.bonus-legend-item span {
    margin-left: 0.3rem;
    color: var(--color-text);
    opacity: 0.8;
    font-size: 0.8rem;
}

/* Adaptation pour les petits écrans */
@media (max-width: 480px) {
    .bonus-legend {
        font-size: 0.7rem;
        gap: 0.3rem;
    }
}

/*--------- Écran final (final-screen) ---------*/
.winner-card {
    background: linear-gradient(145deg, var(--color-bg-card), var(--color-positive));
    margin-bottom: 1.5rem;
    border: 2px solid var(--color-gold);
}

.winner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(216, 212, 192, 0.3);
}

.trophy {
    font-size: 2.5rem;
    margin-right: 1rem;
    color: var(--color-gold);
}

.winner-details {
    flex: 1;
}

.winner-name {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'IM Fell English', serif;
    color: var(--color-secondary);
}

.winner-score {
    font-size: 1.4rem;
}

.player-rank-container {
    display: flex;
    align-items: center;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(216, 212, 192, 0.2);
}

.stat-box {
    flex: 1;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0.7rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-secondary);
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Media Queries */
@media (max-width: 480px) {
    /* On garde la disposition en ligne jusqu'à 350px */
    .bonus-score-container {
        flex-wrap: wrap;
    }
    
    /* En dessous de 350px, passage en colonne */
    @media (max-width: 350px) {
        .bonus-score-container {
            flex-direction: column;
            align-items: flex-start;
        }
        
        .player-round-score {
            margin-left: 0;
            margin-top: 0.5rem;
            align-self: flex-end;
        }
    }
}

@media (min-width: 768px) {
    .player-card {
        transition: transform 0.2s;
    }
    
    .player-card:hover {
        transform: translateY(-3px);
    }
}
