/* ======================================= */
/* STYLES GÉNÉRAUX (Assurez-vous qu'ils existent) */
/* ======================================= */

/* --- Styles Globaux et Fond d'Écran --- */
body, html {
    /* Chemin vers votre image */
    background-image: url('../assets/fond_archive.jpg'); 
    background-size: cover; /* Ajuste l'image pour couvrir toute la zone, sans déformation */
    background-repeat: no-repeat; /* Empêche l'image de se répéter */
    background-position: center center; /* Centre l'image horizontalement et verticalement */
    background-attachment: fixed; /* Fixe l'image de fond pour qu'elle ne défile pas avec le contenu */

    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    color: #f0f0f0; /* Texte clair par défaut */
    background-color: #000;
}

.game-container {
    min-height: 100vh;
    /* Style du fond d'écran. Chemin relatif depuis le CSS (dans 'bibliotheque') */
    background-image: url('../assets/fond_archive.jpg'); 
    background-size: cover; 
    background-repeat: no-repeat; 
    background-position: center center; 
    background-attachment: fixed;
    padding: 20px;
    box-sizing: border-box;
}

/* --- Entête et Boutons de Navigation --- */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85); /* Fond très sombre pour la lisibilité */
    padding: 15px 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.library-header h1 {
    font-family: 'Cinzel Decorative', serif;
    color: #ffd700; /* Or */
    font-size: 2.5em;
    margin: 0;
}

.deck-nav-button img {
    width: 30px; /* Taille de l'icône de retour */
    height: 30px;
    vertical-align: middle;
}

/* --- Filtres (Recherche et Sélecteurs) --- */
.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    margin-bottom: 20px;
}

#searchInput, #typeFilter, #levelFilter {
    padding: 10px 15px;
    border: 1px solid #444;
    border-radius: 5px;
    background-color: #222;
    color: #fff;
    font-size: 1em;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* --- Grille de Cartes --- */
.card-library {
    max-width: 1400px;
    margin: 0 auto;
}

.card-grid {
    display: grid;
    /* Crée une grille responsive : minimum 300px par colonne, maximum 1fr (égal) */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 30px; 
    padding: 20px 0;
}

/* === CORRECTION DU DÉCALAGE === */
.card-item {
    /* 1. Activation et configuration de Flexbox */
    display: flex;
    flex-direction: column;    /* Empile Image puis Info */
    align-items: center;       /* CENTRE HORIZONTALEMENT TOUS LES ÉLÉMENTS ENFANTS (corrige le décalage) */
    text-align: center;        /* Centre le texte dans .card-info */
    
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: rgba(30, 30, 30, 0.95); /* Fond très sombre et opaque */
    border: 2px solid transparent; /* Bordure par défaut pour les niveaux */
}
/* =========================== */

.card-item:hover {
    transform: scale(1.03); /* Léger zoom au survol */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 1);
}

/* === CORRECTION DU DÉCALAGE === */
.game-card {
    /* Assure que l'image est un bloc stable centré par le parent */
    display: block; 
    max-width: 250px; /* Ajout d'une largeur max pour une uniformité visuelle */
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}
/* =========================== */


/* --- Informations de la Carte --- */
/* === CORRECTION DU DÉCALAGE === */
.card-info {
    width: 100%; /* S'assure que la boîte d'information prend toute la largeur */
    padding: 0 5px; /* Petit padding horizontal pour ne pas coller les bords */
    box-sizing: border-box; /* IMPORTANT : Assure que padding et border sont inclus dans la width */
}
/* =========================== */

.card-info h3 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.3em;
    color: #ffd700;
    margin: 0 0 5px 0;
}

.card-info h4 {
    color: #aaa;
    font-style: italic;
    font-weight: normal;
    font-size: 0.9em;
    margin: 0 0 10px 0;
}

.card-info p {
    font-size: 0.9em;
    color: #ddd;
    line-height: 1.4;
    margin-bottom: 15px;
}

.card-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-info li {
    font-weight: bold;
    font-size: 0.95em;
    color: #c0c0c0;
    margin-bottom: 3px;
}

/* --- Styles spécifiques aux Niveaux de Rareté --- */

/* Niveau 1: Cartes de base */
.card-niv-1 {
    border-color: #4a4a4a; /* Gris foncé */
}

/* Niveau 2: Améliorations */
.card-niv-2 {
    border-color: #008cff; /* Bleu vif */
    box-shadow: 0 0 15px rgba(0, 140, 255, 0.6);
}

/* Niveau 3: Cartes spéciales (très rares) */
.card-niv-3 {
    border-color: #ff4500; /* Orange intense */
    background-color: rgba(40, 20, 0, 0.95); /* Fond légèrement plus chaud pour le contraste */
    box-shadow: 0 0 20px #ff9900, 0 0 10px #ff0000; /* Double ombre: Or et Rouge */
}

.card-niv-3 h3, .card-niv-3 .card-level-tag {
    color: #ffaa00; /* Texte spécial en orange/or */
}

.card-level-tag {
    font-size: 0.75em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    margin-left: 5px;
}

/* --- Styles pour le tri (invisible si filtré) --- */
.card-item.hidden {
    display: none;
}