@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Poppins:wght@500;700;900&display=swap');

:root {
    --bg: #121418;
    --card: #1e2228;
    --text: #ffffff;
    --text-dim: #a0a4a8;
    --accent: #be29ec;
    --accent-glow: rgba(190, 41, 236, 0.4);
    --glass: rgba(18, 20, 24, 0.85);
    --danger: #ff3d00;
    --success: #00e676;
    --warning: #ffb74d;
    --info: #64b5f6;
    --border-radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body { 
    background-color: var(--bg); 
    color: var(--text); 
    padding-top: 100px; 
    padding-bottom: 50px; 
}

h1, h2, h3, .logo-font { font-family: 'Poppins', sans-serif; }

/* NAVBAR */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 80px;
    background: var(--glass); backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    z-index: 1000;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 5%;
}
.brand { font-size: 1.8rem; font-weight: 900; letter-spacing: 1px; font-family: 'Poppins'; }
.brand span { color: var(--accent); text-shadow: 0 0 15px var(--accent-glow); }

.nav-links { display: flex; gap: 20px; }
.nav-item {
    color: var(--text-dim); text-decoration: none; font-weight: 600; cursor: pointer;
    padding: 8px 16px; border-radius: 12px; transition: 0.3s;
}
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,0.1); }

.user-controls { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); cursor: pointer; }
.btn-login {
    background: var(--accent); color: white; padding: 10px 20px; border-radius: 50px;
    text-decoration: none; font-weight: bold; box-shadow: 0 4px 15px var(--accent-glow);
    border: none; cursor: pointer; font-size: 1rem;
}

/* STRUCTURE */
.container { max-width: 1600px; margin: 0 auto; padding: 0 20px; }
.page-section { display: none; animation: fadeIn 0.5s ease; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================
   HERO SLIDER
========================= */
.hero-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin-bottom: 30px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    background: #000;
}

.hero-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    justify-content: flex-start;
    align-items: flex-end;
    padding: 40px 5%;
    z-index: 1;
}

.hero-slide img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: -2;
}

.hero-slide::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(0deg, var(--bg) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    z-index: -1;
    pointer-events: none;
}

.fade { animation: fadeEffect 1.5s ease-in-out; }
@keyframes fadeEffect { from {opacity: 0.4} to {opacity: 1} }

.hero-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 15px;
    cursor: pointer;
    border-radius: 50%;
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
    z-index: 10;
    backdrop-filter: blur(5px);
}
.hero-btn:hover { background-color: var(--accent); }
.prev { left: 20px; }
.next { right: 20px; }

.hero-slide h1 {
    font-size: 3rem;
    margin-top: 15px;
    text-shadow: 2px 4px 8px rgba(0,0,0,0.8);
    line-height: 1.1;
    max-width: 800px;
}

@media (max-width: 768px) {
    .hero-container { height: 300px; }
    .hero-slide h1 { font-size: 1.8rem; }
    .hero-btn { padding: 10px; font-size: 1.5rem; width: 45px; height: 45px; }
}

/* CONTROLS */
.controls-bar { display: flex; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.search-input { padding: 12px; background: var(--card); border: 1px solid #333; color: white; border-radius: 10px; }

/* BOUTONS */
.btn-add, .btn-view { 
    background: #333; color: #fff; padding: 10px 15px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition:0.3s;
}
.btn-add:hover, .btn-view.active { background: var(--accent); color: white; box-shadow: 0 0 10px var(--accent-glow); }

/* GRILLE CLASSIQUE */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

.card {
    background: var(--card); border-radius: var(--border-radius); overflow: hidden; position: relative;
    transition: transform 0.3s; border: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-8px); border-color: var(--accent); }

.card-img-container { 
    position: relative; 
    width: 100%;
    height: 280px; 
    overflow: hidden;
    background: #1a1a1a;
} 
.card-img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.3s;
}

.card-body { padding: 15px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* STATUT TAGS */
.card-status {
    position: absolute; top: 10px; right: 10px; padding: 4px 8px; 
    border-radius: 6px; font-size: 0.8rem; font-weight: bold; color: white; backdrop-filter: blur(5px);
}
.status-En.cours { background: var(--info); }
.status-Terminé { background: var(--success); }
.status-En.pause { background: var(--warning); }
.status-Abandonné { background: #757575; }

.chapter-control { display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 8px; }
.btn-chap { background: #333; border: none; color: white; width: 25px; height: 25px; cursor: pointer; border-radius: 4px; }
.card-footer { margin-top: auto; display: flex; gap: 5px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.05); }
.btn-action { flex: 1; padding: 8px; border: none; border-radius: 6px; cursor: pointer; color: white; font-weight: bold; text-align: center; text-decoration: none; font-size: 0.8rem;}
.btn-edit { background: rgba(255,255,255,0.1); }
.btn-del { background: rgba(255,61,0,0.2); color: var(--danger); }

/* --- MODE LISTE --- */
.grid.list-mode { display: flex; flex-direction: column; gap: 10px; }
.grid.list-mode .card { flex-direction: row; height: 140px; align-items: center; padding-right: 15px; }
.grid.list-mode .card-img-container { width: 100px; height: 100%; flex-shrink: 0; }
.grid.list-mode .card-body { flex-direction: row; align-items: center; justify-content: space-between; padding: 0 20px; gap: 20px; }
.grid.list-mode .card-title { width: 25%; margin: 0; }
.grid.list-mode .chapter-control { margin: 0; width: 150px; background: transparent; }
.grid.list-mode .card-footer { width: 200px; border: none; padding: 0; }

/* --- TIERLIST --- */
.tier-row { display: flex; margin-bottom: 5px; border-radius: 8px; overflow: hidden; background: #000; border: 1px solid #333; }
.tier-label { width: 100px; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #000; font-size: 1.5rem; font-family: 'Poppins'; }
.tier-content { flex: 1; background: #1a1a1a; padding: 5px; display: flex; flex-wrap: wrap; gap: 5px; min-height: 90px; }
.tier-img { width: 60px; height: 85px; object-fit: cover; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.tier-img:hover { transform: scale(1.2); z-index: 10; }
.tier-goat { background: linear-gradient(45deg, #FFD700, #FFA500); }
.tier-s { background: #ff7f7f; } .tier-a { background: #ffbf7f; } .tier-b { background: #ffff7f; } .tier-c { background: #7fff7f; }

/* MODALES */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.modal-content { background-color: var(--card); margin: 5% auto; padding: 25px; border: 1px solid var(--accent); width: 90%; max-width: 600px; border-radius: 16px; }
input, select { width: 100%; padding: 10px; background: #121418; border: 1px solid #333; color: white; border-radius: 8px; margin-bottom: 15px; }

/* --- CALENDRIER HEBDOMADAIRE --- */
.calendar-wrapper { width: 100%; overflow-x: auto; padding-bottom: 20px; margin-top: 20px; }
.calendar-days { display: flex; flex-direction: row; gap: 15px; min-width: 1400px; }
.day-column { flex: 1; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 12px; min-height: 400px; display: flex; flex-direction: column; }
.day-column h3 { text-align: center; padding: 15px; background: linear-gradient(180deg, rgba(190, 41, 236, 0.2) 0%, transparent 100%); color: var(--accent); border-radius: 12px 12px 0 0; font-size: 1rem; font-weight: 900; border-bottom: 1px solid rgba(255,255,255,0.05); letter-spacing: 2px; margin-bottom: 10px; }
.day-content { padding: 10px; display: flex; flex-direction: column; gap: 15px; }

.cal-card { background: var(--card); border-radius: 8px; overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,0.1); transition: 0.2s; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.cal-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(190, 41, 236, 0.2); }
.cal-card img { width: 100%; height: 160px; object-fit: cover; background: #1a1a1a; transition: 0.3s; }
.cal-card:hover img { opacity: 1; }
.cal-info { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(0deg, black 0%, rgba(0,0,0,0.9) 60%, transparent 100%); padding: 10px; padding-top: 30px; }
.cal-info h4 { font-size: 0.9rem; color: white; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; text-shadow: 0 2px 4px black; }
.cal-tag { font-size: 0.7rem; font-weight: bold; color: #000; text-transform: uppercase; background: var(--success); padding: 3px 8px; border-radius: 4px; display: inline-block; }
.cal-tag.pause { background: var(--warning); }

.hidden-force { display: none !important; visibility: hidden !important; opacity: 0 !important; }

#sortSelect { cursor: pointer; background-color: var(--card); color: white; border: 1px solid #333; }

/* --- MODALE STYLE TWITCH (AJOUTÉ) --- */
.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: flex; align-items: center; justify-content: center;
}

.auth-box {
    background: #18181b; /* Couleur de fond Twitch Dark */
    width: 400px;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    color: #efeff1;
    font-family: 'Inter', sans-serif;
}

/* INPUTS */
.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.85rem; }
.twitch-input {
    width: 100%; padding: 10px;
    background: #0e0e10;
    border: 2px solid transparent; 
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
}
.twitch-input:focus {
    border-color: #a970ff; /* Violet Twitch au focus */
    background: #000;
}
/* ERREUR SUR L'INPUT */
.twitch-input.input-error {
    border-color: #e91916; /* Rouge Twitch erreur */
}

/* BOUTONS */
.twitch-btn {
    width: 100%;
    background: #9147ff;
    color: white;
    font-weight: bold;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}
.twitch-btn:hover { background: #772ce8; }

.twitch-switch-btn {
    background: none; border: none;
    color: #a970ff;
    font-weight: bold;
    font-size: 0.85rem;
    margin-top: 15px;
    cursor: pointer;
    width: 100%;
    text-align: center;
}
.twitch-switch-btn:hover { text-decoration: underline; }

/* LA BOX D'ERREUR ROUGE */
.twitch-error {
    background: rgba(235, 4, 0, 0.1);
    border: 1px solid rgba(235, 4, 0, 0.5);
    border-left: 4px solid #e91916;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.error-icon { color: #e91916; font-size: 1.2rem; }
.error-text { color: #efeff1; font-size: 0.9rem; font-weight: 600; }