/* --- VUES & MENUS (Pré-partie, Fin de partie, Modals) --- */
.view, #game-over, #loading-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

.view:not(.active) {
    display: none;
}

.menu-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- MODAL --- */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background-color: #2c3e50;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    border: 2px solid #7f8c8d;
}

#modal-title {
    margin-bottom: 15px;
    color: #f1c40f;
}

#modal-message {
    margin-bottom: 20px;
    line-height: 1.5;
}

#modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* --- MENU PRINCIPAL --- */
#pre-game-menu {
    justify-content: space-between; /* Pousse les éléments aux extrémités */
    background: linear-gradient(to bottom, #1e3c58, #0a1829);
    padding-top: env(safe-area-inset-top); /* Espace pour la barre de statut iOS/Android */
}

/* Barre de statistiques (Or, Gemmes) */
.player-stats-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px solid;
    border-radius: 20px;
    padding: 5px 15px;
    font-weight: bold;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

.stat-box .stat-icon {
    font-size: 1.2em;
}

.gold-box { border-color: #f1c40f; }
.gems-box { border-color: #2ecc71; }

/* Contenu central du menu */
#pre-game-menu .menu-content {
    gap: 15px;
    align-items: center; /* Centrer le contenu */
}

#pre-game-menu h1 {
    font-size: 2.5em;
    color: #f1c40f;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    letter-spacing: 1px;
}

.trophy-display {
    background-color: rgba(0,0,0,0.2);
    padding: 8px 20px;
    border-radius: 15px;
    font-size: 1.5em;
    font-weight: bold;
    border: 2px solid #7f8c8d;
}

/* Bouton JOUER stylisé */
#play-button {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    padding: 20px 60px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(to bottom, #f39c12, #e67e22);
    border-bottom: 8px solid #c0392b;
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
    transition: all 0.1s ease-in-out;
}

#play-button:hover { background: linear-gradient(to bottom, #f5a623, #f7931e); }

#play-button:active {
    transform: translateY(5px);
    border-bottom-width: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

/* Barre de navigation principale */
#main-nav-bar {
    display: flex;
    width: 100%;
    background-color: #1a252f;
    border-top: 3px solid #4a5c6d;
    padding: 5px;
    gap: 5px;
}

#main-nav-bar .nav-button {
    flex: 1;
    padding: 10px 5px;
    font-size: 1em;
    font-weight: bold;
    background-color: #2c3e50;
    color: #bdc3c7;
    border: 2px solid #4a5c6d;
    border-radius: 10px;
    transition: all 0.2s;
}

#main-nav-bar .nav-button:hover { background-color: #34495e; }

#main-nav-bar .nav-button.active {
    background-color: #3498db;
    color: white;
    border-color: #5dade2;
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

#main-nav-bar.disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* --- VUE DECK BUILDER & SHOP --- */
#deck-view .menu-content, #shop-view .menu-content {
    width: 95%;
    max-width: 500px;
    background-color: #2c3e50;
    border: 3px solid #7f8c8d;
    border-radius: 10px;
    padding: 15px;
    gap: 15px;
}

#deck-view h1, #shop-view h1 {
    color: #f1c40f;
    text-shadow: 2px 2px 4px black;
}

/* Sélecteur de deck */
#deck-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

#deck-selector button {
    background-color: #7f8c8d;
    border: 2px solid #95a5a6;
    font-weight: bold;
}

#deck-selector button.active {
    background-color: #f1c40f;
    color: #2c3e50;
    border-color: white;
}

/* Conteneurs pour Deck et Collection */
#my-deck, #available-cards {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    border: 2px solid #1e272e;
    position: relative;
}

#my-deck {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    justify-items: center;
    min-height: 190px; /* 2 lignes de cartes de 90px + gap */
    margin-bottom: 25px; /* Espace avant la collection */
}

#available-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 8px;
    max-height: 35vh; /* Hauteur relative à la vue */
    overflow-y: auto;
}

/* Titres de section */
#my-deck::before {
    content: 'Mon Deck';
    position: absolute;
    top: -12px;
    left: 15px;
    background-color: #7f8c8d;
    color: white;
    padding: 2px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 1px black;
}

/* Style de la scrollbar */
#available-cards::-webkit-scrollbar { width: 8px; }
#available-cards::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#available-cards::-webkit-scrollbar-thumb { background: #7f8c8d; border-radius: 4px; }
#available-cards::-webkit-scrollbar-thumb:hover { background: #95a5a6; }

/* Style des cartes DANS le deck builder */
#deck-view .card { width: 65px; height: 90px; cursor: grab; transition: transform 0.15s, box-shadow 0.15s; }
#deck-view .card:hover { transform: translateY(-2px) scale(1.1); z-index: 10; box-shadow: 0 6px 12px rgba(0,0,0,0.6); }
#deck-view .card .card-cost { width: 20px; height: 20px; font-size: 0.8em; top: 3px; left: 3px; }
#deck-view .card .card-level { font-size: 0.6em; padding: 1px 3px; top: 3px; right: 3px; }
#deck-view .card .card-name { font-size: 0.7em; }
#deck-view .card .card-name-container { padding: 3px; }

/* Pour la collection, on peut cacher le nom pour alléger */
#available-cards .card { height: 85px; }
#available-cards .card .card-name-container { display: none; }

/* Style pour le bouton retour */
#deck-back-btn, #shop-back-btn { margin-top: 15px; background-color: #c0392b; }
#deck-back-btn:hover, #shop-back-btn:hover { background-color: #e74c3c; }

/* --- FILTRES (Deck Builder) --- */
#collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#collection-header span {
    background-color: #7f8c8d;
    color: white;
    padding: 2px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 1px black;
}

#filter-toggle-btn {
    background-color: #7f8c8d;
    border: 2px solid #95a5a6;
    border-radius: 5px;
    width: 36px;
    height: 28px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
#filter-toggle-btn:hover {
    background-color: #95a5a6;
}

/* Panneau de filtres */
#filter-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    background-color: #1e272e;
    border: 2px solid #7f8c8d;
    border-radius: 10px;
    padding: 15px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

#filter-panel h3 {
    text-align: center;
    color: #f1c40f;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #7f8c8d;
}

#filter-panel .filter-group { display: flex; flex-direction: column; gap: 8px; }
#filter-panel .filter-group span { font-weight: bold; color: #bdc3c7; font-size: 0.9em; }
#filter-panel .buttons-container { display: flex; gap: 8px; flex-wrap: wrap; }
#filter-panel .filter-btn { background: #444; border: 1px solid #666; color: white; padding: 5px 12px; border-radius: 5px; font-size: 0.9em; }
#filter-panel .filter-btn.active { background: #f1c40f; color: #2c3e50; border-color: white; font-weight: bold; }

#close-filter-btn { margin-top: 10px; background-color: #2ecc71; }
#close-filter-btn:hover { background-color: #27ae60; }