:root {
    --primary-color: #e50914;
    --background-color: #141414;
    --card-background: #2f2f2f;
    --text-color: #ffffff;
}

body {
    font-family: 'Inter', sans-serif; /* Cambio clave */
    background-color: #141414; /* El negro exacto de Netflix */
    color: #e5e5e5;
    -webkit-font-smoothing: antialiased; /* Texto más nítido en Mac */
}

/* HEADER & LOADING */
.main-header {
    display: flex;
    align-items: center;
    padding: 20px 50px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0));
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo { margin-right: 20px; }
.logo img { height: 35px; width: auto; display: block; }
.welcome-message { color: #cccccc; font-size: 0.9em; white-space: nowrap; margin-right: 20px; }
.search-container { flex-grow: 1; display: flex; justify-content: flex-end; }
#search-input { 
    background-color: rgba(0, 0, 0, 0.5); 
    border: 1px solid #444; 
    color: var(--text-color); 
    padding: 8px 15px; 
    border-radius: 4px; 
    width: 300px; 
    font-size: 1em; 
}

.loader-container {
    display: flex; flex-direction: column; justify-content: center; align-items: center; height: 50vh;
}
.loader {
    border: 6px solid #f3f3f3; border-top: 6px solid var(--primary-color);
    border-radius: 50%; width: 50px; height: 50px; animation: spin 1.5s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* MAIN GRID CONTENT */
#content-grid { padding: 0 50px 50px 50px; }
.category-row { margin-bottom: 40px; position: relative; }
.category-title { font-size: 1.4em; margin-bottom: 15px; color: #e5e5e5; font-weight: bold;}

.cards-container { 
    display: flex; overflow-x: auto; padding-bottom: 20px; 
    scrollbar-width: none; scroll-behavior: smooth; 
}
.cards-container::-webkit-scrollbar { display: none; }

.video-card { 
    flex: 0 0 280px; height: 160px; 
    background-color: var(--card-background); 
    margin-right: 10px; border-radius: 4px; 
    overflow: hidden; cursor: pointer; 
    transition: transform 0.2s ease-in-out, z-index 0s; 
    position: relative; 
}

.video-card:hover {
    transform: scale(1.4); /* Crece bastante */
    z-index: 100; /* Se pone muy por encima */
    box-shadow: 0 10px 20px rgba(0,0,0,0.7);
    transition-delay: 0.4s; /* Pequeño delay para que no "parpadee" si pasas el mouse rápido */
    border-radius: 0; /* Al crecer se vuelven cuadradas */
}


.video-card img { width: 100%; height: 100%; object-fit: cover; }
.card-title { 
    position: absolute; bottom: 0; left: 0; right: 0; 
    padding: 40px 15px 15px 15px; 
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); 
    font-size: 0.85em; opacity: 0; transition: opacity 0.2s ease; 
    font-weight: bold; text-align: center;
}
.video-card:hover .card-title { opacity: 1; }

/* SERIES BADGE */
.series-badge {
    position: absolute; top: 8px; left: 8px;
    background-color: var(--primary-color); color: white;
    padding: 3px 6px; font-size: 0.65em; font-weight: bold;
    border-radius: 2px; z-index: 20; letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
    font-size: 0.6em; /* Un poquito más pequeño para que quepa el texto largo */
    letter-spacing: 0.5px;
    white-space: nowrap; /* Evita que el texto se rompa en dos líneas */
}

/* SCROLL ARROWS */
.scroll-arrow { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.6); color: white; border: none; cursor: pointer; font-size: 2.5em; font-weight: bold; z-index: 20; padding: 20px 5px; line-height: 0; opacity: 0; transition: opacity 0.2s ease, background-color 0.2s ease; }
.category-row:hover .scroll-arrow { opacity: 1; }
.scroll-arrow:hover { background-color: rgba(0, 0, 0, 0.8); }
.scroll-arrow.prev { left: -50px; border-radius: 5px 0 0 5px; }
.scroll-arrow.next { right: -50px; border-radius: 0 5px 5px 0; }
.scroll-arrow.hidden { display: none; }


/* MODALS (Shared) */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background-color: rgba(0, 0, 0, 0.9); display: none; 
    justify-content: center; align-items: center; z-index: 1000; 
}
.modal-content { position: relative; width: 80%; max-width: 900px; background: #000; }
.close-button { position: absolute; top: -35px; right: 0; font-size: 2.5em; color: #fff; cursor: pointer; }
.video-container { position: relative; padding-bottom: 56.25%; height: 0; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* === NEW SERIES VIEW STYLES === */
.series-layout {
    background-color: #181818;
    color: white;
    max-width: 850px;
    width: 90%;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.series-header {
    padding: 40px;
    background-color: #333;
    background-size: cover;
    background-position: center top;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}
.series-header::before {
    content: '';
    position: absolute; top:0; left:0; right:0; bottom:0;
    background: linear-gradient(to top, #181818 5%, rgba(0,0,0,0.4) 100%);
    z-index: 0;
}

.series-info { position: relative; z-index: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.8); }
.series-info h2 { font-size: 2.2em; margin: 0 0 10px 0; }
.series-info p { font-size: 1.1em; color: #ddd; max-width: 600px; line-height: 1.4; margin: 0; }
.series-meta { margin-top: 15px; font-weight: bold; color: #aaa; font-size: 0.85em; text-transform: uppercase; letter-spacing: 1px; }

.episodes-scroll-container {
    padding: 0 40px 40px 40px;
    overflow-y: auto;
    flex-grow: 1;
    background-color: #181818;
}

.episodes-heading { color: #fff; margin: 20px 0; font-size: 1.2em; border-bottom: 1px solid #333; padding-bottom: 10px;}

.episode-row {
    display: flex; align-items: center; padding: 15px;
    border-bottom: 1px solid #333; cursor: pointer;
    transition: background 0.2s; border-radius: 4px; margin-bottom: 5px;
}
.episode-row:hover { background-color: #333; }

.ep-number { font-size: 1.5em; color: #777; width: 40px; text-align: center; margin-right: 15px; font-weight: bold;}
.ep-thumb { width: 130px; height: 73px; object-fit: cover; border-radius: 4px; margin-right: 15px; background: #222; }
.ep-info { flex-grow: 1; }
.ep-title { font-weight: bold; font-size: 1em; margin-bottom: 5px; display: block; color: white; }
.ep-desc { font-size: 0.85em; color: #aaa; display: block; line-height: 1.3; max-width: 450px; }

.play-icon-btn {
    width: 34px; height: 34px;
    border: 2px solid #aaa; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 14px; margin-left: 15px; opacity: 0; color: #aaa;
    transition: all 0.2s;
}
.episode-row:hover .play-icon-btn { opacity: 1; border-color: white; color: white; transform: scale(1.1); }

.close-series-button {
    position: absolute; top: 15px; right: 20px;
    font-size: 2.5em; color: white; cursor: pointer; z-index: 100;
    text-shadow: 0 2px 4px black; line-height: 0.7; opacity: 0.8;
}
.close-series-button:hover { opacity: 1; }

.ep-watched { color: #46d369; margin-left: 8px; font-size: 0.75em; border: 1px solid #46d369; padding: 1px 4px; border-radius: 2px;}

@media (max-width: 600px) {
    .main-header { flex-direction: column; padding: 15px; }
    #search-input { width: 100%; margin-top: 10px; }
    #content-grid { padding: 0 15px 20px 15px; }
    .series-header { padding: 20px; min-height: 150px; }
    .episodes-scroll-container { padding: 0 20px 20px 20px; }
    .ep-thumb { width: 90px; height: 50px; }
    .ep-desc { display: none; } /* Ocultar descripciones de episodios en móvil */
}

/* Asegura que el reproductor de video siempre esté ENCIMA de la lista de series */
#video-modal {
    z-index: 2000 !important; /* Mayor que el 1000 de series-modal */
}

/* HERO BILLBOARD */
.hero-billboard {
    height: 70vh; /* Alto impactante */
    position: relative;
    background-size: cover;
    background-position: center center;
    display: flex;
    align-items: center;
    color: white;
    margin-bottom: -50px; /* Superposición ligera con el grid */
}

/* Oscurecimiento para que el texto resalte */
.hero-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, #141414 0%, rgba(20,20,20,0.6) 40%, rgba(0,0,0,0.4) 100%);
}

.hero-content {
    position: relative; z-index: 10;
    padding-left: 50px;
    max-width: 600px; /* Ancho máximo para que no ocupe toda la pantalla */
    padding-bottom: 50px;
}

#hero-title {
    font-size: 3.5rem; margin-bottom: 15px; line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

#hero-desc {
    font-size: 1.2rem; margin-bottom: 25px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; /* Limita a 3 líneas */
}

.btn-hero {
    padding: 12px 30px; border: none; border-radius: 4px;
    font-size: 1.2rem; font-weight: bold; cursor: pointer; margin-right: 15px;
    transition: transform 0.2s;
}
.btn-hero:hover { transform: scale(1.05); }

.btn-primary { background-color: white; color: black; }
.btn-secondary { background-color: rgba(109, 109, 109, 0.7); color: white; }

@media (max-width: 768px) {
    .hero-billboard { height: 50vh; align-items: flex-end; }
    .hero-content { padding-left: 20px; padding-bottom: 20px; }
    #hero-title { font-size: 2rem; }
}
