/* ================================================================= */
/* GUIDE.CSS - LAYOUT FIXE "APP" (Header figé, scroll sur la liste) */
/* ================================================================= */

:root {
    --bg-app: #0b0c10;       
    --bg-panel: #1f2833;     
    --bg-grid: #151920;      
    
    --accent-color: #45a29e; 
    --highlight: #66fcf1;    
    
    --text-main: #ffffff;
    --text-muted: #c5c6c7;
    
    --prog-bg: #1E88E5;      
    --prog-border: rgba(255,255,255,0.1);
    
    --sidebar-width: 160px;
    --row-height: 60px;
}

/* --- 1. CONFIGURATION PLEIN ÉCRAN (CRUCIAL POUR FIGER LE HAUT) --- */
html, body {
    height: 100%; /* Force la page à faire 100% de la hauteur fenêtre */
    margin: 0;
    padding: 0;
    overflow: hidden; /* Empêche le scroll de toute la page */
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
}

body {
    display: flex;
    flex-direction: column; /* Empile les éléments verticalement */
}

/* --- 2. ÉLÉMENTS FIGÉS EN HAUT --- */
header {
    text-align: center;
    padding: 20px;
    background-color: var(--bg-app);
    border-bottom: 1px solid #333;
    flex-shrink: 0; /* Ne rétrécit pas */
}

h1 {
    font-weight: 300;
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(102, 252, 241, 0.3);
}

#filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 15px;
    gap: 10px;
    background-color: var(--bg-app);
    flex-shrink: 0; /* Ne rétrécit pas */
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.filter-btn.active {
    background: var(--accent-color);
    border-color: var(--highlight);
    color: var(--bg-app);
    font-weight: bold;
}

/* --- 3. CONTENEUR DE LA GRILLE (Prend tout l'espace restant) --- */
#grid-wrapper {
    flex: 1; /* Prend toute la hauteur restante en bas */
    display: flex;
    flex-direction: column; /* Empile Axe Temps + Liste Chaînes */
    
    margin: 0 20px 20px 20px;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: var(--bg-grid);
    overflow: hidden; /* Contient le scroll interne */
}

/* --- AXE TEMPOREL (Figé en haut du wrapper) --- */
#time-axis-container {
    display: flex;
    height: 40px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid #444;
    align-items: center;
    flex-shrink: 0; /* Reste fixe en haut */
}

.channel-placeholder {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    border-right: 1px solid #444;
    height: 100%;
}

#time-axis {
    flex-grow: 1;
    display: flex;
}

.time-marker {
    flex: 1;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-left: 1px dashed rgba(255,255,255,0.1);
}

/* --- 4. ZONE DE DÉFILEMENT (SEUL CET ÉLÉMENT SCROLLE) --- */
#epg-container {
    flex: 1; /* Prend toute la hauteur restante */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 🌟 C'EST ICI QUE LE SCROLL VERTICAL SE FAIT */
    overflow-x: hidden;
}

/* Style de la scrollbar pour faire propre */
#epg-container::-webkit-scrollbar {
    width: 8px;
}
#epg-container::-webkit-scrollbar-track {
    background: var(--bg-app);
}
#epg-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

/* --- LIGNES ET PROGRAMMES --- */
.channel-row {
    display: flex;
    height: var(--row-height);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background-color: var(--bg-grid);
    position: relative;
    flex-shrink: 0; /* Empêche l'écrasement */
}

.channel-row:hover {
    background-color: rgba(255,255,255,0.03);
}

.channel-info {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    display: flex;
    align-items: center;
    padding: 0 10px;
    background-color: var(--bg-panel);
    border-right: 1px solid #444;
    gap: 10px;
    z-index: 5;
    
    /* Garde le logo visible même si on scrolle horizontalement (si on le remettait) */
    position: sticky;
    left: 0;
}

.channel-logo {
    max-width: 40px;
    max-height: 35px;
    object-fit: contain;
}

.channel-info a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.program-schedule {
    flex-grow: 1;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.program-item {
    position: absolute;
    top: 5px;
    bottom: 5px;
    background: var(--prog-bg);
    border: 1px solid var(--prog-border);
    border-radius: 4px;
    padding: 0 10px;
    color: white;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1;
}

.program-item:hover {
    background-color: var(--highlight);
    color: var(--bg-app);
    z-index: 10;
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(102, 252, 241, 0.3);
}

.program-schedule > *:not(.program-item) {
    position: absolute;
    left: 20px;
    top: 20px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}
