/* --- 1. Variables Globales et Base --- */
:root {
--bg: #0f0f0f;
--panel: #141414;
--muted: #9b9b9b;
--accent: #01ff2b; /* accent vert Vision Ultime */
--card-shadow: rgba(0, 0, 0, 0.6);
--max-width: 1200px;
--radius: 10px;
--red-btn: #e60000;
font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
box-sizing: border-box;
}

html,
body {
height: 100%;
}

body {
    margin: 0;
/* Dégradé de fond sombre */
background: linear-gradient(180deg, var(--bg), #0b0b0b 70%); 
color: #e8e8e8;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
color: #fff;
text-decoration: none;
transition: color 0.2s;
}

a:hover {
    color: var(--accent);
}

/* --- 2. EN-TÊTE (Header) --- */
.site-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 18px;
background: linear-gradient(180deg, #0e0e0e, #121212);
border-bottom: 1px solid rgba(255, 255, 255, 0.03);
position: sticky;
top: 0;
z-index: 20;
}

.header-left {
display: flex;
align-items: center;
gap: 12px;
}

.brand {
    display: inline-flex;
align-items: center;
gap: 8px;
text-decoration: none;
color: #fff;
font-weight: 700;
}

.brand-box {
background: var(--accent);
color: #111;
padding: 6px 8px;
border-radius: 6px;
font-weight: 800;
}

/* Barre de recherche principale (PC) */
.header-center {
flex-grow: 1;
display: flex;
justify-content: center;
max-width: 520px;
    margin: 0 20px;
}

.search-form {
display: flex;
    align-items: center;
    gap: 8px;
width: 100%; /* Important pour que la recherche principale prenne la place */
}

.search-input {
width: 100%;
min-width: 120px;
padding: 10px 12px;
border-radius: 999px; /* Forme de pilule */
border: 1px solid rgba(255, 255, 255, 0.05);
background: rgba(255, 255, 255, 0.02);
color: #fff;
outline: none;
}

/* On utilise le bouton classique pour la recherche principale */
.search-btn {
background: var(--accent);
color: #111;
border: none;
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
flex-shrink: 0;
}

/* Boutons de droite (Profil/Déconnexion ou Recherche Catégorie) */
.header-right {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}

/* Bouton caché (la loupe) */
.search-icon-btn {
display: none !important;
}

/* Boutons de profil/déconnexion */
.btn, .auth-btn, .logout-btn {
background-color: var(--accent);
color: var(--panel) !important;
border: none;
padding: 8px 16px;
border-radius: 6px;
font-size: 1em;
font-weight: 700;
text-decoration: none;
cursor: pointer;
transition: background-color 0.3s, opacity 0.3s;
}

.logout-btn { 
background-color: var(--red-btn); 
color: #fff !important; 
}
.logout-btn:hover {
background-color: #cc0000;
}


/* Remplacement de la barre de recherche de catégorie (initialement cachée) */
#categorySearchReplace {
display: none;
width: 100%;
max-width: 300px;
}

.search-form-in-header {
display: flex;
width: 100%;
}
.search-form-in-header .search-input {
border-radius: 999px 0 0 999px;
}
.search-form-in-header .search-btn {
border-radius: 0 8px 8px 0;
}
.hidden {
display: none !important;
}

/* --- 2.5 Conteneur Principal pour Centrage et Largeur --- */
.content-wrapper {
/* Largeur maximale pour centrer tout le contenu de la page */
max-width: var(--max-width); 
margin: 0 auto;
padding: 0 18px; /* Ajout d'un padding pour les bords */
}

/* --- 3. Contenu Principal et Grille --- */
.main-content {
/* Remplace l'ancienne classe .main */
width: 100%;
margin: 24px 0; 
}

.hero {
text-align: center;
}
.hero h1 {
font-size: 28px;
margin: 0 0 6px;
}

.subtitle {
color: var(--muted);
margin: 0 0 22px;
}

/* BANNIERES DES CATEGORIES */
.categories {
display: flex;
justify-content: center;
flex-wrap: wrap; /* Assure que ça passe à la ligne si besoin */
gap: 30px;
margin-top: 50px;
padding: 0 20px;
}

.category-banner {
display: flex;
justify-content: center;
    align-items: center;
    width: 350px;
height: 200px;
font-size: 1.8em;
font-weight: bold;
    border-radius: var(--radius);
background-size: cover;
    background-position: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
    border: 3px solid transparent;
text-shadow: 0 0 5px black;
    color: #fff;
    overflow: hidden;
}

.category-banner:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

/* Simulation d'images de fond (AJUSTEZ LES CHEMINS si besoin) */
.banner-france {
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('images/france-bg.jpg');
}

.banner-monde {
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('images/monde-bg.jpg');
}

/* Grille de vidéos */
.grid {
display: grid;
/* CORRECTION FINALE : Force 4 colonnes pour les grands écrans */
grid-template-columns: repeat(4, 1fr); 
gap: 16px;
    justify-content: flex-start; 
}

.card {
background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.02));
border-radius: var(--radius);
overflow: hidden;
box-shadow: 0 6px 22px var(--card-shadow);
transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
transform: translateY(-6px);
box-shadow: 0 14px 36px rgba(0, 0, 0, 0.7);
}

.thumb-wrap {
position: relative;
height: 150px;
background: #0b0b0b;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}

.thumb-wrap img, .thumb-wrap video {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}

.duration {
position: absolute;
right: 8px;
bottom: 8px;
background: rgba(0, 0, 0, 0.6);
padding: 4px 6px;
border-radius: 6px;
font-weight: 700;
font-size: 12px;
color: #fff;
}

.card-body {
padding: 10px;
}

.title {
font-size: 14px;
margin: 0 0 6px;
line-height: 1.2;
color: #fff;
}

.meta {
font-size: 12px;
color: var(--muted);
}

/* --- 4. Pied de Page (Footer) --- */
.site-footer {
max-width: var(--max-width);
margin: 24px auto 0;
padding: 30px 18px 40px;
text-align: center;
color: var(--muted);
font-size: 13px;
border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-links {
margin-bottom: 15px;
display: flex;
justify-content: center;
gap: 25px;
}

.footer-links a {
color: var(--muted);
font-weight: 500;
}

.footer-links a:hover {
color: var(--accent);
}

.copyright {
margin-top: 10px;
color: #666;
    font-size: 12px;
}

/* --- 5. Écran de Chargement --- */
.loading-screen {
position: fixed;
top: 0;
left: 0;
    width: 100%;
height: 100%;
background-color: var(--bg);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
opacity: 1;
transition: opacity 1s ease-out;
}

.loading-content {
font-size: 3em;
font-weight: 800;
display: flex;
    gap: 10px;
}

.loading-text {
color: #fff;
position: relative;
    display: inline-block;
text-transform: uppercase;
-webkit-text-stroke: 1px var(--accent);
    text-stroke: 1px var(--accent);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
background-image: linear-gradient(to right, var(--accent), var(--accent));
background-size: 0% 100%;
background-repeat: no-repeat;
background-position: left center;
}

.loading-content.green-fill .loading-text {
animation: fillTextReverse 2s forwards;
}

.loading-content.green-fill .loading-text:first-child {
animation-delay: 0.5s;
}

.loading-content.green-fill .loading-text:last-child {
    animation-delay: 0s;
}

@keyframes fillTextReverse {
0% {
background-size: 0% 100%;
background-position: left center;
}
100% {
        background-size: 100% 100%;
        background-position: right center;
    }
}

/* --- 6. RESPONSIVE PC/TABLETTE (Max 900px) --- */
/* Ajout d'une media query pour 3 colonnes sur tablette */
@media (min-width: 901px) and (max-width: 1100px) {
    .grid {
        /* 3 colonnes pour les écrans de taille moyenne */
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
.search-input {
width: 260px;
}
.watch-main {
grid-template-columns: 1fr;
}
/* Masque la barre de recherche complète et laisse le logo/boutons */
.header-center {
        display: none; 
}
    /* Le logo et les boutons prennent plus d'espace */
    .site-header {
justify-content: space-around;
gap: 20px;
}
}

/* --- 7. RESPONSIVE MOBILE (Max 600px) --- */
@media (max-width: 600px) {

/* CORRECTION CENTRAGE DE LA PAGE */
.main-content {
padding: 0 12px; /* Réduit le padding sur les bords */
margin: 18px 0; /* Marge verticale */
}
    .hero {
text-align: center; /* Centre le titre et le sous-titre */
    }

/* HEADER */
.site-header {
flex-wrap: wrap; /* Permet aux éléments d'aller à la ligne */
padding: 10px 12px;
gap: 8px;
justify-content: space-between;
}

/* La barre de recherche (si elle réapparaît) doit être pleine largeur */
.header-center {
order: 3; /* Se place en bas */
display: flex; /* Rétablit l'affichage de la barre de recherche (voir votre JS/HTML) */
width: 100%;
max-width: 100%;
margin-top: 5px; 
}

.search-form {
display: flex;
}

/* Boutons de droite */
.header-right {
order: 2; /* Se place à droite du logo */
gap: 5px;
}
.header-left {
        order: 1; /* Le logo reste à gauche */
}

/* GRILLE DE VIDÉOS */
.grid {
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}

.thumb-wrap {
height: 120px;
}

.card-body {
padding: 8px; }
.title {
font-size: 13px;
}

/* CORRECTION CENTRAGE BANNIÈRES DE CATÉGORIE */
    .categories {
flex-direction: column; /* Empile les bannières */
        align-items: center; /* TRÈS IMPORTANT: Centre les bannières */
        gap: 15px;
}

.category-banner {
width: 100%;
max-width: 350px; /* Limite la largeur pour une meilleure lisibilité */
height: 160px;
        font-size: 1.5em;
}
}

/* --- 8. AUTHENTIFICATION (Connexion/Inscription) --- */
.auth-page {
display: flex;
justify-content: center;
align-items: center;
min-height: 80vh; /* Centre au milieu de l'écran */
}

.login-container {
background: var(--panel);
padding: 35px;
border-radius: var(--radius);
box-shadow: 0 4px 25px var(--card-shadow);
max-width: 400px;
width: 90%; /* Prend 90% sur mobile */
text-align: center;
}

.login-container h1 {
font-size: 2em;
color: var(--accent);
margin-bottom: 25px;
}

.form-group {
text-align: left;
margin-bottom: 15px;
}

.form-group label {
display: block;
margin-bottom: 5px;
color: #fff;
font-weight: 500;
}

.login-input {
width: 100%;
padding: 12px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 6px;
background: #1f1f1f;
color: #fff;
font-size: 1em;
outline: none; /* SUPPRIME LE CARRÉ JAUNE/BLEU */
}

.login-input:focus {
/* Assure qu'aucun effet indésirable ne se produit au focus */
border-color: rgba(255, 255, 255, 0.1);
box-shadow: none;
}

.login-btn {
width: 100%;
/* Utilise les styles définis dans la section 2 pour .btn */
padding: 12px 0;
margin-top: 15px;
font-size: 1.1em;
}

.login-container p a {
color: var(--accent);
font-weight: 700;
}

@media (max-width: 600px) {
.auth-page {
padding: 20px;
}
}