/* ==========================================================================
   FICHIER CSS DÉDIÉ À LA PAGE D'ACCUEIL (index.html)
   Auteur : MKR
   Description : Styles pour la grille de jeux, recherche, filtres et navigation
   ========================================================================== */

/* ==========================================================================
   SECTION 1 : RESET & SYSTÈME DE DESIGN
   ========================================================================== */

* {
    box-sizing: border-box;
}

:root {
    --bg-color: #0d0d0d;
    --card-bg: #1a1a1a;
    --text-color: #e0e0e0;
    --neon-color: #bc13fe;
    --accent-color: #bc13fe;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* Espacement et Marges */
    --grid-gap: 40px;
    --side-padding: 3vw;
}

body.light-mode {
    --bg-color: #f4f4f9;
    --card-bg: #ffffff;
    --text-color: #222222;
    --neon-color: #bc13fe;
    --accent-color: #bc13fe;
    --card-border: #ddd;
}

/* ==========================================================================
   SECTION 2 : STYLES GLOBAUX DU BODY
   ========================================================================== */

/* Scrollbar personnalisée */
html {
    scroll-behavior: smooth;
    scrollbar-color: var(--neon-color) var(--bg-color);
}

::selection {
    background-color: var(--neon-color);
    color: #ffffff;
}

::-moz-selection {
    background-color: var(--neon-color);
    color: #ffffff;
}

::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--card-bg);
    border: 2px solid var(--neon-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    padding: 20px 0;
    line-height: 1.6;
    transition: background-color 0.4s, color 0.4s;
    overflow-x: hidden;
}

/* ==========================================================================
   SECTION 3 : EN-TÊTE & TITRE PRINCIPAL
   ========================================================================== */

header,
#game-grid {
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 15px;
    margin-bottom: 100px;
    text-align: center;
    padding: 0 15px;
    margin-top: clamp(100px, 12vw, 100px);
}

h1 {
    font-size: clamp(2rem, 5vw, 5.5rem);
    /* Grandit avec l'écran jusqu'en 4K */
    letter-spacing: clamp(2px, 0.5vw, 8px);
    margin: 0;
}

.site-subtitle {
    font-style: italic;
    font-size: clamp(0.8rem, 1.2vw, 1.5rem);
    opacity: 0.8;
}

.neon-text {
    color: var(--neon-color);
    text-shadow: 0 0 20px var(--neon-color);
}

/* ==========================================================================
   SECTION 4 : BARRE DE RECHERCHE & FILTRES
   ========================================================================== */

.search-container {
    position: relative;
    width: 100%;
    max-width: clamp(340px, 22.5vw, 675px);
    /* ⬅️ Permet de grossir proportionnellement */
    margin: 10px auto 25px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#search-bar {
    width: 100%;
    padding: clamp(10px, 1vw, 20px) 40px clamp(10px, 1vw, 20px) 20px;
    font-size: clamp(0.75rem, 0.9vw, 1.35rem);
    border-radius: clamp(25px, 2vw, 40px);
    border: 1px solid var(--neon-color);
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

#search-bar:focus {
    box-shadow: 0 0 15px var(--neon-color);
}

.clear-btn {
    position: absolute;
    right: 15px;
    color: var(--neon-color);
    cursor: pointer;
    display: none !important;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.clear-btn.visible {
    display: block !important;
}

.clear-btn:hover {
    opacity: 1;
}

.game-counter {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 1rem;
    font-weight: bold;
    margin: 0;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(10px, 1vw, 20px);
    margin-top: clamp(10px, 1vw, 20px);
}

.filters button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--neon-color);
    color: var(--neon-color);
    padding: clamp(8px, 0.8vw, 16px) clamp(16px, 1.5vw, 30px);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    border-radius: 4px;
    font-size: clamp(0.75rem, 0.85vw, 1.3rem);
    transition: transform 0.2s ease, background 0.3s, box-shadow 0.3s;
}

.filters button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--neon-color);
    /* Restauration du halo lumineux neon violet */
}

.filters button.active {
    background: var(--neon-color);
    color: #fff;
    box-shadow: 0 0 15px var(--neon-color);
    /* Garde le halo quand il est activé */
}

.sort-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   SECTION 5 : GRILLE DE JEUX
   ========================================================================== */

#game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
    width: 100%;
    padding: 0 var(--side-padding);
    align-items: stretch;
}

/* ==========================================================================
   SECTION 6 : CARTES DE JEUX
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.game-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #bc13fe;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;

    display: flex;
    flex-direction: column;
    height: 100%;

    position: relative;
    transform: translateZ(0);
    opacity: 1;
}

.game-card.animating {
    animation: fadeInUp 0.6s ease-out forwards;
}

.game-card:hover {
    transform: translateY(-7px);
    border: 2px solid #bc13fe;
    box-shadow: 0 0px 25px #bc13fe, 0 0 0 1px #bc13fe;
}

.game-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    /* Format rectangulaire "cinématographique" luxueux */
    overflow: hidden;
    background-color: var(--bg-color);
    flex-shrink: 0;
}

/* ==========================================================================
   SECTION 7 : SKELETON LOADING
   ========================================================================== */

.skeleton {
    background: #2a2a2a;
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.game-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Remplit absolument tout son cadre (Zero bande vide) */
    opacity: 0;
    transition: opacity 0.5s ease;
}

.game-img img.loaded {
    opacity: 1;
}

/* ==========================================================================
   SECTION 8 : ÉLÉMENTS DES CARTES (AJUSTEMENTS COMPACITÉ)
   ========================================================================== */

.rating-badge {
    position: absolute;
    border: 2px solid #0d0d0d;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 5;
    transition: border-color 0.3s ease;
}

.game-content {
    padding: 20px;
    /* Plus d'espace et d'air que les 15px originaux */
    padding-bottom: 60px;
    /* Conserve de la marge pour le bouton '+' sans étouffer */

    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.game-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
    min-height: 2.4em;
    display: flex;
    align-items: center;
}

.game-info {
    margin-bottom: 8px;
    font-weight: bold;

}

.game-review {
    margin: 0;
    display: block;
    width: 100%;

    /* Le texte s'affiche en entier, sans troncature */
    line-height: 1.6;
    /* Un tout petit peu plus espacé pour le côté "pro" */
    font-size: clamp(0.9rem, 1.1vw, 1.4rem);
    /* Reste lisible peu importe la résolution */
    opacity: 0.8;
    /* Adoucit la couleur pour détacher du titre */
    flex-grow: 1;
}

.btn-plus {
    position: absolute;
    /* ✅ AJUSTEMENT : Descendu un peu plus bas (15px -> 10px) */
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    white-space: nowrap;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.btn-plus::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.btn-plus:hover {
    transform: translateX(-50%) scale(1.05);
}

.btn-plus:hover::after {
    width: 100%;
}

/* ==========================================================================
   SECTION 9 : BOUTONS D'INTERFACE
   ========================================================================== */

.top-controls {
    position: absolute;
    top: 40px;
    right: 40px;
    z-index: 1000;
    display: flex;
    gap: 15px;
}

#language-btn,
#theme-btn {
    background: var(--card-bg);
    border: 1px solid var(--neon-color);
    color: var(--neon-color);
    width: clamp(45px, 4vw, 75px);
    height: clamp(45px, 4vw, 75px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

}

#language-btn:hover,
#theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--neon-color);
}

#theme-btn {
    font-size: 1.2rem;
    font-weight: bold;
}

#language-btn {
    font-size: 1rem;
    font-weight: bold;
}

#language-flag {
    font-weight: bold;
    letter-spacing: 1px;
}

.top-left-controls {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}



.disclaimer-btn {
    background: var(--card-bg);
    border: 1px solid var(--neon-color);
    color: var(--neon-color);
    width: clamp(300px, 20vw, 320px);
    /* Largeur fixe pour ne pas rétrécir lors du changement de langue, avec plus d'espace */
    padding: 0;
    height: clamp(45px, 4vw, 75px);
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-weight: bold;
    font-size: clamp(0.9rem, 1vw, 1.3rem);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 5px rgba(188, 19, 254, 0.2);
}

.disclaimer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--neon-color);
}

.disclaimer-btn i {
    font-size: 1.1rem;
}

#back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    border: 1px solid var(--neon-color);
    background: var(--card-bg);
    color: var(--neon-color);
    border-radius: 50%;
    width: 75px;
    height: 75px;
    display: none;
    z-index: 1000;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#back-to-top:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--neon-color);
}

.aurora-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    transform: translate(0, 0) scale(1);
    pointer-events: none;
    z-index: 0;
    will-change: transform, opacity;
    transition: opacity 5s ease-in-out, transform 15s ease-in-out;
}

.aurora-blob.active {
    opacity: 1;
    transform: translate(25px, -18px) scale(1.15);
}

.blob1 {
    width: 750px;
    height: 550px;
    background: radial-gradient(circle, #9900ff44 0%, transparent 60%);
    top: -10%;
    left: -10%;
}

.blob3 {
    width: 700px;
    height: 500px;
    background: radial-gradient(circle, #b026ff44 0%, transparent 60%);
    top: -5%;
    right: -10%;
}

.blob6 {
    width: 750px;
    height: 550px;
    background: radial-gradient(circle, #9d00ff44 0%, transparent 60%);
    top: 50%;
    left: 20%;
}

.blob10 {
    width: 850px;
    height: 650px;
    background: radial-gradient(circle, #9900ff33 0%, transparent 60%);
    bottom: -10%;
    left: -5%;
}

.blob2 {
    width: 600px;
    height: 450px;
    background: radial-gradient(circle, #e026ff33 0%, transparent 60%);
    top: 20%;
    right: 15%;
}

.blob4 {
    width: 800px;
    height: 600px;
    background: radial-gradient(circle, #7a00ff33 0%, transparent 60%);
    bottom: 20%;
    right: 5%;
}

.blob5 {
    width: 650px;
    height: 500px;
    background: radial-gradient(circle, #bc13fe33 0%, transparent 60%);
    top: 40%;
    left: 45%;
}

.blob7 {
    width: 720px;
    height: 520px;
    background: radial-gradient(circle, #a100ff33 0%, transparent 60%);
    bottom: 5%;
    left: 30%;
}

/* ==========================================================================
   SECTION 10 : RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1100px) {
    #game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --side-padding: 20px;
    }

    .top-controls {
        top: 15px;
        right: 15px;
        gap: 10px;
    }

    .top-left-controls {
        top: 15px;
        left: 15px;
    }

    .disclaimer-btn {
        padding: 0;
        width: 45px;
        height: 45px;
        min-width: 0;
        border-radius: 50%;
    }

    .disclaimer-btn .disclaimer-full {
        display: none;
    }

    .disclaimer-btn .disclaimer-short {
        display: inline;
        font-size: 0.75rem;
    }

    .disclaimer-btn i {
        margin: 0;
    }

    #language-btn,
    #theme-btn {
        width: 45px;
        height: 45px;
        font-size: 0.8rem;
    }

    #language-flag {
        font-size: 0.8rem;
    }

    .search-container {
        flex-direction: column;
        gap: 8px;
    }

    .game-counter {
        position: static;
        text-align: center;
        transform: none;
        margin-top: 5px;
    }

    #game-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 {
        letter-spacing: 2px;
    }
}

/* ==========================================================================
   SECTION 11 : RESPONSIVE INTERMÉDIAIRE (chevauchement titre)
   ========================================================================== */

/* Entre 769px et 1024px : le bouton disclaimer est trop large, on le compacte */
@media (min-width: 769px) and (max-width: 1024px) {
    .top-left-controls {
        top: 20px;
        left: 20px;
    }

    .top-controls {
        top: 20px;
        right: 20px;
    }

    /* Bouton plus compact : on cache le texte long et on met une abréviation */
    .disclaimer-btn {
        min-width: 0;
        padding: 0;
        width: clamp(45px, 4vw, 75px);
        height: clamp(45px, 4vw, 75px);
        border-radius: 50%;
        font-size: 0.9rem;
    }

    .disclaimer-btn .disclaimer-full {
        display: none;
    }

    .disclaimer-btn .disclaimer-short {
        display: inline;
    }

    /* Le header a besoin d'un peu plus d'espace vertical */
    header {
        margin-top: 90px;
    }
}



/* Par défaut : short caché, full visible */
.disclaimer-short {
    display: none;
}

/* ==========================================================================
   SECTION 12 : ACCESSIBILITÉ - prefers-reduced-motion
   Désactive les animations lourdes pour les utilisateurs qui ont demandé
   moins de mouvement (gain perf gratuit + accessibilité).
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .aurora-blob {
        display: none;
    }

    #particles {
        display: none;
    }
}

/* ==========================================================================
   SECTION 13 : FOOTER
   ========================================================================== */

.site-footer {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 25px 20px;
    margin-top: 60px;
    margin-bottom: -20px; /* Compense le padding: 20px du body pour coller au bas */
    background: #1a1a1a;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(188, 19, 254, 0.2);
    text-align: center;
    position: relative;
    z-index: 10;
}

body.light-mode .site-footer {
    background: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(188, 19, 254, 0.4);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.6;
    flex-wrap: wrap;
    transition: opacity 0.3s ease;
}

.footer-content:hover {
    opacity: 1;
}

.footer-separator {
    color: var(--neon-color);
    opacity: 0.5;
}

@media (max-width: 480px) {
    .footer-content {
        flex-direction: column;
        gap: 5px;
    }
    .footer-separator {
        display: none;
    }
}