/* --- RESET & VARIABLES (THÈME PERSONA 5 ROYAL) --- */
:root {
    --text-light: #f8f9fa;
    --glass-bg: rgba(8, 8, 8, 0.92); /* Noir extrêmement profond */
    
    /* Palette P5R Officielle */
    --p5-red: #e60012;
    --p5-dark-red: #8b0000;
    --p5-gold: #cba052;
    --p5-gold-light: #f4d07b;
    --p5-black: #000000;
    
    /* Dégradé de cadre : Rouge Sang agressif vers Or Royal */
    --gradient-border: linear-gradient(135deg, var(--p5-red) 0%, var(--p5-dark-red) 40%, var(--p5-gold) 100%); 
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--p5-black);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
}

/* Couche de contraste pour assombrir le fond d'écran */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(15, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.95) 100%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* --- APPARENCE DES CADRES (EFFET P5R) --- */
header, .filter-section, .user-board, .form-container {
    background: linear-gradient(var(--glass-bg), var(--glass-bg)) padding-box, 
                var(--gradient-border) border-box;
    border: 2px solid transparent;
    border-radius: 8px; /* Coins un peu plus carrés pour l'agressivité */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 15px 40px rgba(230, 0, 18, 0.15); /* Halo rouge diffus */
    padding: 25px;
    margin-bottom: 40px;
}

/* --- TITRES --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px 25px;
}

header h1, .page-title {
    font-size: 2rem;
    font-weight: 900;
    font-style: italic; /* Style P5 typique */
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 3px 3px 0px var(--p5-red), -1px -1px 0px var(--p5-gold);
}

.page-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2rem;
}

.user-board-header h3 {
    font-size: 1.6rem;
    font-weight: 800;
    font-style: italic;
    color: #fff;
    margin: 0;
    text-transform: uppercase;
}

/* --- BOUTONS DYNAMIQUES --- */
.actions { display: flex; gap: 12px; }

.btn {
    background: var(--p5-red);
    color: #fff;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 4px;
    font-weight: 900;
    font-style: italic;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    transform: skewX(-5deg); /* Effet de mouvement P5 */
    display: inline-block;
}

.btn:hover {
    background: var(--p5-gold);
    color: #000;
    transform: skewX(-5deg) scale(1.05);
    box-shadow: 0 5px 15px rgba(203, 160, 82, 0.4);
}

.btn-outline {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--p5-red);
    color: #fff;
}

.btn-outline:hover {
    background: var(--p5-red);
    color: #fff;
    border-color: var(--p5-red);
}

/* --- FILTRES UTILISATEURS --- */
.filter-section {
    padding: 20px 25px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.filter-label {
    font-weight: 900;
    font-style: italic;
    color: var(--p5-gold-light);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.users-checkboxes { display: flex; gap: 12px; flex-wrap: wrap; }
.checkbox-container input { display: none; }

.custom-checkbox {
    display: inline-block;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s ease;
    user-select: none;
    transform: skewX(-5deg);
}

.checkbox-container input:checked + .custom-checkbox {
    background: var(--gradient-border);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(230, 0, 18, 0.4);
    font-weight: 900;
}

/* --- NAVIGATION MENU (ANNÉES & BACKLOG) --- */
.navigation-menu { display: flex; gap: 10px; margin-bottom: 30px; flex-wrap: wrap; justify-content: center; }

.nav-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--p5-red);
    color: #fff;
    padding: 10px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 900;
    font-style: italic;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    transform: skewX(-5deg);
}

.nav-btn:hover { background: rgba(230, 0, 18, 0.2); box-shadow: 0 0 10px rgba(230, 0, 18, 0.5); }

.nav-btn.active {
    background: var(--p5-red);
    color: #fff;
    box-shadow: 0 4px 15px rgba(230, 0, 18, 0.5);
    border-color: transparent;
}

.btn-backlog { border-color: var(--p5-gold); }
.btn-backlog:hover { background: rgba(203, 160, 82, 0.2); box-shadow: 0 0 10px rgba(203, 160, 82, 0.5); }
.btn-backlog.active { background: var(--p5-gold); color: #000; box-shadow: 0 4px 15px rgba(203, 160, 82, 0.5); border-color: transparent; }

/* --- TABLEAU DES JEUX --- */
.user-board-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 2px dashed rgba(230, 0, 18, 0.3);
    padding-bottom: 15px;
}

table { width: 100%; border-collapse: collapse; }

th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.05); transition: padding 0.2s, font-size 0.2s; }

body.grid-small-mode th, body.grid-small-mode td {
    padding: 6px 10px;
    font-size: 0.85rem;
}

th {
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--p5-gold-light);
    letter-spacing: 1px;
    font-weight: 900;
}

tr:hover td { background: rgba(230, 0, 18, 0.05); }

/* --- AVATARS & COMPTEUR --- */
.board-avatar {
    width: 55px; height: 55px;
    border-radius: 4px; /* Forme plus tranchée */
    object-fit: cover;
    border: 2px solid var(--p5-gold);
    transform: rotate(-3deg);
    transition: width 0.2s, height 0.2s;
}

.board-avatar-fallback {
    width: 55px; height: 55px;
    border-radius: 4px;
    background: var(--p5-red);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 900; font-style: italic;
    border: 2px solid var(--p5-gold);
    transform: rotate(-3deg);
    transition: width 0.2s, height 0.2s, font-size 0.2s;
}

body.grid-small-mode .board-avatar, 
body.grid-small-mode .board-avatar-fallback {
    width: 35px; height: 35px;
}

body.grid-small-mode .board-avatar-fallback {
    font-size: 1rem;
}

.game-count-badge {
    display: inline-block;
    background: var(--p5-red);
    color: #fff;
    border: 1px solid var(--p5-gold);
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 900;
    font-style: italic;
    margin-left: 15px;
    vertical-align: middle;
    transform: skewX(-5deg);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.8);
}

/* --- BADGES NOTES (THÈME P5R) --- */
.badge-grade {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 3px;
    font-weight: 900;
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    min-width: 45px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transform: skewX(-5deg);
    border: 1px solid rgba(255,255,255,0.2);
}

/* S+ : Or Royal Extrême (Le Vrai Platine de Royal) */
.grade-S-plus { background: linear-gradient(135deg, #fff2cc 0%, #cba052 40%, #997328 100%); color: #000; box-shadow: 0 0 15px var(--p5-gold); border: 1px solid #fff; text-shadow: none; }
/* S : Rouge Persona Pur */
.grade-S { background: linear-gradient(135deg, #ff3333 0%, var(--p5-red) 50%, #660000 100%); color: #fff; box-shadow: 0 0 12px var(--p5-red); border: 1px solid var(--p5-gold); }
/* S- : Noir et Or Mat */
.grade-S-minus { background: #111; color: var(--p5-gold); border: 1px solid var(--p5-gold); box-shadow: inset 0 0 10px rgba(203, 160, 82, 0.2); }

/* A : Vert Cyané (Ambiance Velvet Room) */
.grade-A-plus { background: hsl(160, 100%, 35%); color: #fff; box-shadow: 0 0 8px hsl(160, 100%, 35%); }
.grade-A { background: hsl(160, 80%, 30%); color: #fff; }
.grade-A-minus { background: hsl(160, 60%, 25%); color: #ccc; }

/* B : Jaune Électrique (Skull/Ryuji) */
.grade-B-plus { background: hsl(45, 100%, 50%); color: #000; text-shadow: none; }
.grade-B { background: hsl(45, 90%, 40%); color: #000; text-shadow: none; }
.grade-B-minus { background: hsl(45, 60%, 30%); color: #ccc; }

/* C : Orange/Marron (Oracle) */
.grade-C-plus { background: hsl(25, 90%, 50%); color: #fff; }
.grade-C { background: hsl(25, 80%, 40%); color: #fff; }
.grade-C-minus { background: hsl(25, 60%, 35%); color: #ccc; }

/* D : Violet (Noir/Haru) */
.grade-D-plus { background: hsl(280, 70%, 50%); color: #fff; }
.grade-D { background: hsl(280, 60%, 40%); color: #fff; }
.grade-D-minus { background: hsl(280, 40%, 35%); color: #ccc; }

/* E : Gris Froid */
.grade-E-plus { background: hsl(210, 20%, 50%); color: #fff; }
.grade-E { background: hsl(210, 20%, 40%); color: #ccc; }
.grade-E-minus { background: hsl(210, 15%, 35%); color: #aaa; }

/* F : Noir complet, texte rouge */
.grade-F-plus { background: #111; color: #ff6666; border-color: #ff6666; }
.grade-F { background: #000; color: var(--p5-red); border-color: var(--p5-red); }
.grade-F-minus { background: #000; color: #660000; border-color: #660000; }

/* --- TRI ET FILTRES DYNAMIQUES --- */
.th-sortable { color: var(--p5-gold-light); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: color 0.2s; }
.th-sortable:hover { color: #fff; }
.sort-icon { font-size: 0.75rem; color: #555; }
.sort-icon.active { color: var(--p5-red); text-shadow: 0 0 5px var(--p5-red); }

.grade-filters-container { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 25px; flex-wrap: wrap; }
.filter-btn { transition: all 0.2s ease; text-decoration: none; padding: 6px 18px; font-size: 1rem; opacity: 0.3; filter: grayscale(80%); border: 2px solid transparent; cursor: pointer; }
.filter-btn:hover { opacity: 0.8; transform: skewX(-5deg) scale(1.05); }
.filter-btn.active { opacity: 1; filter: grayscale(0%); transform: skewX(-5deg) scale(1.1); border: 2px solid #fff; box-shadow: 0 0 15px currentColor; }
.grade-filters-container.no-filter .filter-btn { opacity: 0.85; filter: grayscale(0%); }
.grade-filters-container.no-filter .filter-btn:hover { opacity: 1; transform: skewX(-5deg) scale(1.1); }



/* --- BARRE DE RECHERCHE --- */
.search-container { display: flex; gap: 10px; flex-grow: 1; max-width: 400px; justify-content: flex-end; }
.search-input {
    width: 100%; padding: 10px 15px; border-radius: 4px;
    border: 2px solid var(--p5-red); background: rgba(0, 0, 0, 0.8);
    color: #fff; font-weight: bold; font-style: italic; transform: skewX(-5deg);
}
.search-input:focus { outline: none; box-shadow: 0 0 10px rgba(230, 0, 18, 0.5); }

/* --- DASHBOARD STATISTIQUES --- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card {
    background: rgba(0,0,0,0.8); border: 2px solid var(--p5-red);
    padding: 20px; text-align: center; border-radius: 4px; transform: skewX(-3deg);
    box-shadow: 0 5px 15px rgba(230,0,18,0.2);
}
.stat-card h4 { color: var(--p5-gold-light); font-size: 1.1rem; font-style: italic; text-transform: uppercase; margin-bottom: 10px; }
.stat-card .stat-value { font-size: 2.8rem; font-weight: 900; color: #fff; text-shadow: 3px 3px 0 var(--p5-red); }

.stat-bar-container { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.stat-bar-label { font-size: 1.4rem; font-weight: 900; width: 40px; text-align: right; color: var(--p5-gold); font-style: italic; }
.stat-bar-bg { flex-grow: 1; background: rgba(255,255,255,0.05); height: 30px; border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.stat-bar-fill { height: 100%; background: var(--gradient-border); display: flex; align-items: center; padding-left: 10px; font-weight: 900; color: #fff; font-style: italic; text-shadow: 1px 1px 2px #000; }




/* --- JAQUETTES DE JEUX --- */
.game-cover {
    width: 65px;
    height: 85px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--p5-red);
    transform: skewX(-5deg);
    box-shadow: 2px 2px 0px rgba(0,0,0,0.8);
    transition: all 0.2s ease-in-out;
    background-color: var(--p5-black);
}

/* Effet de pop quand on survole l'image */
.game-cover:hover {
    transform: skewX(-5deg) scale(1.8);
    box-shadow: 0 10px 20px rgba(230, 0, 18, 0.6);
    z-index: 100;
    position: relative;
    border-color: var(--p5-gold);
}

/* Image de remplacement si aucune URL n'est fournie */
.game-cover-fallback {
    width: 65px;
    height: 85px;
    background: linear-gradient(135deg, var(--p5-red), #660000);
    border: 2px solid var(--p5-gold);
    transform: skewX(-5deg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-style: italic;
    font-size: 0.8rem;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.8);
}





/* --- ACTIONS ADMIN & FORMULAIRES --- */
.admin-td { text-align: right; }
.text-edit {
    color: var(--p5-gold);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
}
.text-edit:hover { color: var(--p5-red); text-shadow: 0 0 5px rgba(230, 0, 18, 0.5); }

input[type="text"], input[type="number"], select, input[type="file"] {
    width: 100%; padding: 12px; border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2); 
    background: rgba(0, 0, 0, 0.6); color: #fff;
    font-weight: bold;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--p5-red);
    box-shadow: 0 0 8px rgba(230, 0, 18, 0.4);
}

select option { background-color: var(--p5-black); color: #fff; font-weight: bold; }

.alert { padding: 12px; border-radius: 4px; margin-bottom: 15px; font-weight: bold; }
.alert-success { background: rgba(203, 160, 82, 0.2); border: 1px solid var(--p5-gold); color: var(--p5-gold-light); }
.alert-danger { background: rgba(230, 0, 18, 0.2); border: 1px solid var(--p5-red); color: #ff6666; }
.info-box { background: rgba(255, 255, 255, 0.05); border-left: 4px solid var(--p5-gold); padding: 15px; margin-bottom: 20px; font-size: 0.9em; }
/* --- VUE GRILLE & CARTES --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

body.grid-small-mode .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.game-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-card-img {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: height 0.3s ease;
}

body.grid-small-mode .grid-container .game-card-img {
    height: 180px;
}

body.grid-small-mode .grid-container .game-card-info h4 {
    font-size: 0.9rem;
}

body.grid-small-mode .grid-container .game-card-meta {
    font-size: 0.7rem;
}

.game-card-grade {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.game-card-grades-vs {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0,0,0,0.6);
    padding: 5px;
}

.game-card-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card-info h4 {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #fff;
}

.game-card-meta {
    font-size: 0.85em;
    color: #aaa;
}

.display-toggle .btn.active {
    background: #fff;
    color: #000;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    /* Header */
    header { flex-direction: column; align-items: center; text-align: center; gap: 15px; }
    .actions { flex-wrap: wrap; justify-content: center; }
    header h1 { font-size: 2.2rem; }

    /* Layout general */
    .container { margin: 10px; padding: 15px; }
    
    /* Index.php - Filtres & Dashboard */
    .filter-section > div { flex-direction: column; align-items: stretch; }
    .users-checkboxes { justify-content: center; }
    .filter-label { margin-bottom: 10px; text-align: center; min-width: auto !important; }
    .display-toggle { flex-wrap: wrap; justify-content: center; width: 100%; }
    .search-container { max-width: 100%; justify-content: center; margin-top: 10px; }
    
    /* Navigation Menu (Years) */
    .navigation-menu { gap: 5px; }
    .nav-btn { padding: 8px 12px; font-size: 0.9rem; }
    
    /* Grilles */
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .game-card-img { height: 180px; }
    
    body.grid-small-mode .grid-container { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    body.grid-small-mode .grid-container .game-card-img { height: 140px; }
    
    /* Tables */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; margin-bottom: 15px; }
    th, td { white-space: nowrap; padding: 10px; font-size: 0.9rem; }
    
    /* Profil & Badges */
    .user-board-header { flex-direction: column; text-align: center; gap: 10px; }
    .profile-layout { flex-direction: column !important; }
    .stat-cards { grid-template-columns: 1fr; }
}
