/* --- RESET GLOBAL --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden; /* IMPORTANTE: Evita scroll lateral */
    position: relative;
    background-color: #000000;
}

:root {
    --background: #000000;
    --surface: #1c1c1e;
    --primary: #2997ff;
    --text-main: #f5f5f7;
    --text-secondary: #86868b;
    --font-stack: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    font-family: var(--font-stack);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

/* --- NAV --- */
nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; height: 70px; width: 100%;
    position: sticky; top: 0; z-index: 1000;
    background-color: rgba(0, 0, 0, 0.75); backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-left { flex: 1; display: flex; align-items: center; }
.icono-home { width: 40px; height: auto; transition: transform 0.3s; }
.icono-home:hover { transform: scale(1.1); }

.nav-center { flex: 2; display: flex; justify-content: center; }
.search-wrapper { position: relative; width: 100%; max-width: 450px; }
.nav-search-input {
    width: 100%; background: rgba(255,255,255,0.15); border: 1px solid transparent;
    border-radius: 10px; padding: 8px 40px 8px 15px; color: white; outline: none; transition: 0.3s;
}
.nav-search-input:focus { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.3); }
.nav-search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: rgba(255,255,255,0.6); pointer-events: none; }

.nav-links { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 25px; }
.nav-links a { text-decoration: none; color: rgba(255,255,255,0.8); font-size: 14px; font-weight: 500; transition: color 0.3s; }
.nav-links a:hover, .nav-links a.active { color: white; }

/* --- HERO & INDEX LAYOUT --- */
.hero-section {
    height: 85vh; width: 100%; background-size: cover; background-position: top;
    position: relative; display: flex; align-items: flex-end; margin-top: -70px;
    transition: background-image 1s ease-in-out;
}
.hero-content { position: relative; z-index: 2; padding: 0 5% 120px 5%; max-width: 700px; transition: opacity 0.3s; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--background), transparent 60%, rgba(0,0,0,0.6)); z-index: 1; }
#hero-titulo { font-size: clamp(32px, 5vw, 64px); font-weight: 700; text-shadow: 0 4px 20px black; margin-bottom: 10px; }
#hero-descripcion { font-size: 18px; color: #ddd; margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 2px 10px black; }
.hero-buttons button { padding: 12px 30px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; margin-right: 10px; transition: transform 0.2s; }
.btn-play { background: white; color: black; }
.btn-info { background: rgba(255,255,255,0.3); color: white; backdrop-filter: blur(10px); }
.hero-buttons button:hover { transform: scale(1.05); }

/* --- LAYOUTS --- */
.contenedor-catalogo {
    display: grid; grid-template-columns: 1fr 320px; gap: 40px;
    width: 90%; max-width: 1600px; margin: 40px auto; align-items: start;
}

.container-general {
    width: 90%; max-width: 1600px; margin: 40px auto; min-height: 60vh;
}
.container-general h2 { margin-bottom: 30px; border-bottom: 1px solid #333; padding-bottom: 15px; }

/* --- GRILLA Y CARDS --- */
.grid-peliculas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.card {
    position: relative; cursor: pointer; transition: transform 0.3s;
    background: transparent; border: none; border-radius: 12px; overflow: hidden;
    aspect-ratio: 2/3; box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.card:hover { transform: scale(1.05); z-index: 10; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.card-image-container { width: 100%; height: 100%; position: relative; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-overlay {
    position: absolute; bottom: 0; left: 0; right: 0; height: 70%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, transparent 100%);
    display: flex; align-items: flex-end; padding: 15px;
    opacity: 0; transition: opacity 0.3s;
}
.card:hover .card-overlay { opacity: 1; }
.scrolling-text { color: white; font-weight: 600; white-space: nowrap; font-size: 15px; }
.card:hover .scrolling-text { animation: scroll-left 5s linear infinite; animation-delay: 0.5s; }
@keyframes scroll-left { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

.btn-fav-card {
    position: absolute; top: 10px; right: 10px; width: 32px; height: 32px;
    background: rgba(30,30,30,0.6); backdrop-filter: blur(5px); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.2); color: white; opacity: 0; transition: 0.3s; z-index: 20;
}
.card:hover .btn-fav-card { opacity: 1; }
.btn-fav-card:hover { background: var(--primary); transform: scale(1.1); border-color: transparent; }

/* --- SIDEBAR & HEADERS --- */
.cabecera-seccion { display: flex; gap: 20px; border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 20px; align-items: baseline; }
.cabecera-seccion h2 { font-size: 20px; text-transform: uppercase; border-bottom: 3px solid var(--primary); padding-bottom: 10px; margin-bottom: -12px; color: white; }
.subtitulos span { font-size: 13px; font-weight: 600; color: #666; cursor: pointer; margin-right: 15px; transition: 0.3s; }
.subtitulos span:hover { color: #bbb; }
.subtitulos span.active-tab { color: white; border-bottom: 2px solid white; padding-bottom: 2px; }

.seccion-lateral { display: flex; flex-direction: column; gap: 15px; }
.sidebar-item { display: flex; gap: 15px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: background 0.2s; }
.sidebar-item:hover { background: rgba(255,255,255,0.05); }
.sidebar-thumb { width: 70px; height: 100px; object-fit: cover; border-radius: 4px; }
.sidebar-info h4 { font-size: 14px; margin: 0 0 5px 0; color: white; }
.rating-row { color: #FFD700; font-size: 12px; font-weight: bold; }
.badge-year { position: absolute; bottom: 5px; right: 5px; background: var(--primary); font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: bold; color: white;}

/* --- FOOTER --- */
footer { background-color: var(--surface); border-top: 1px solid rgba(255, 255, 255, 0.05); padding: 60px 0 20px 0; margin-top: 80px; font-size: 14px; }
.footer-container { width: 90%; max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; padding-bottom: 40px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.footer-col h3 { color: white; font-size: 16px; margin-bottom: 20px; font-weight: 600; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s ease; }
.footer-col a:hover { color: var(--primary); }
.footer-brand p { color: var(--text-secondary); line-height: 1.6; margin-top: 15px; }
.footer-logo-img { width: 140px; opacity: 0.9; }
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-icon { width: 40px; height: 40px; background: rgba(255,255,255,0.05); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s; color: white; border: 1px solid rgba(255,255,255,0.05); }
.social-icon:hover { background: var(--primary); transform: translateY(-3px); border-color: transparent; }
.social-icon svg { width: 20px; height: 20px; fill: currentColor; }
.footer-bottom { text-align: center; padding-top: 20px; color: #555; font-size: 12px; }
.footer-sin-margen { margin-top: 0 !important; border-top: none; background: linear-gradient(to bottom, #000, #111); }

/* --- OTROS --- */
.header-spacer { height: 50px; width: 100%; }
.dropdown { position: relative; height: 100%; display: flex; align-items: center; }
.dropdown-menu { position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(10px); background: rgba(28,28,30,0.95); padding: 10px; border-radius: 12px; opacity: 0; visibility: hidden; transition: 0.3s; width: 200px; backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); z-index: 1005; }
.dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(15px); }
.dropdown-menu a { display: block; padding: 8px 15px; color: #aaa; border-radius: 6px; }
.dropdown-menu a:hover { background: rgba(255,255,255,0.1); color: white; }
.skeleton { background: var(--surface); border-radius: 12px; aspect-ratio: 2/3; position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent); animation: shimmer 1.5s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* --- DETALLES DE PELICULA Y FAVORITOS --- */
.favorites-header { background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%); padding: 50px; border-radius: 24px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 20px 40px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); position: relative; overflow: hidden; }
.favorites-header::after { content: ''; position: absolute; top: -50%; right: -10%; width: 300px; height: 300px; background: radial-gradient(circle, rgba(41,151,255,0.15) 0%, transparent 70%); filter: blur(40px); }
.fav-info h1 { font-size: 36px; margin: 0 0 10px 0; background: linear-gradient(90deg, #fff, #aaa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.fav-stats { color: var(--text-secondary); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.btn-clear-all { background: rgba(255, 59, 48, 0.1); color: #ff3b30; border: 1px solid rgba(255, 59, 48, 0.2); padding: 10px 20px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.3s; z-index: 2; }
.btn-clear-all:hover { background: #ff3b30; color: white; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty-icon { width: 80px; height: 80px; margin-bottom: 20px; opacity: 0.2; color: white; }
.btn-explore { background-color: var(--primary); color: white; padding: 12px 30px; border-radius: 25px; text-decoration: none; font-weight: 600; display: inline-block; margin-top: 20px;}

.detail-hero { position: relative; min-height: 85vh; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: top; padding: 100px 0 60px 0; margin-top: -70px; }
.detail-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(20px); z-index: 1; }
.detail-content { position: relative; z-index: 2; width: 90%; max-width: 1200px; display: flex; gap: 60px; align-items: flex-start; }
.detail-poster { flex-shrink: 0; width: 350px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.detail-text { color: white; padding-top: 20px; }
.detail-title { font-size: 48px; font-weight: 800; margin-bottom: 10px; line-height: 1.1; }
.detail-tagline { font-size: 18px; font-style: italic; color: var(--primary); margin-bottom: 25px; }
.meta-row { display: flex; align-items: center; gap: 20px; margin-bottom: 25px; font-size: 15px; color: #ccc; }
.rating-badge { display: flex; align-items: center; gap: 5px; background: rgba(255,255,255,0.1); padding: 5px 12px; border-radius: 8px; color: #FFD700; border: 1px solid rgba(255,255,255,0.1); }
.genres-list { display: flex; gap: 10px; margin-bottom: 30px; flex-wrap: wrap; }
.genre-tag { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 16px; border-radius: 20px; font-size: 13px; }
.detail-overview { font-size: 16px; line-height: 1.8; color: rgba(255,255,255,0.9); margin-bottom: 40px; max-width: 800px; }
.action-buttons { display: flex; gap: 20px; }
.btn-large-play { background: var(--primary); color: white; border: none; padding: 15px 40px; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.btn-large-fav { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); padding: 15px 30px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.provider-section { margin: 25px 0; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.provider-title { font-size: 14px; color: var(--text-secondary); margin: 0 0 12px 0; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.provider-list { display: flex; gap: 12px; flex-wrap: wrap; }
.provider-logo { width: 45px; height: 45px; border-radius: 10px; object-fit: cover; cursor: title; }

/* --- RESPONSIVE / MOBILE (CORREGIDO Y OPTIMIZADO) --- */

/* Hamburguesa */
.hamburger { display: none; cursor: pointer; flex-direction: column; gap: 6px; z-index: 2000; padding: 10px; }
.hamburger span { display: block; width: 26px; height: 2px; background-color: white; border-radius: 2px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: translateX(-10px); }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* Overlay de Fondo */
.menu-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); z-index: 10000; opacity: 0; visibility: hidden; transition: all 0.3s; }
.menu-overlay.active { opacity: 1; visibility: visible; }

/* MOBILE MEDIA QUERY */
@media (max-width: 900px) {
    nav { 
        padding: 0 20px; 
        justify-content: space-between;
        z-index: 10001; /* Encima del overlay */
        background-color: #000000; /* Fondo sólido */
        backdrop-filter: none; /* Quitamos blur para no romper fixed */
    }
    
    .nav-center { display: none; }
    .hamburger { display: flex; }

    /* MENU LATERAL FIX (USANDO TRANSFORM) */
    .nav-links {
        position: fixed;
        top: 0;
        right: 0; /* Siempre a la derecha */
        transform: translateX(100%); /* Pero movido fuera de la pantalla */
        width: 280px;
        height: 100vh;
        background-color: #161618; /* Gris oscuro elegante */
        flex-direction: column;
        justify-content: flex-start;
        /* Padding vertical: 90px arriba, 40 abajo. Horizontal 0 */
        padding: 90px 0 40px 0; 
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        z-index: 10002;
        box-shadow: -10px 0 30px rgba(0,0,0,0.7);
        display: flex;
        border-left: 1px solid rgba(255,255,255,0.08);
        overflow-y: auto;
    }
    
    .nav-links.active { 
        transform: translateX(0); /* Vuelve a la pantalla */
    }
    
    /* ENLACES PRINCIPALES (Inicio, Tendencias...) */
    .nav-links > a { 
        font-size: 18px;
        font-weight: 600;
        width: 100%; 
        text-align: left; 
        /* Padding: 25px izquierda para que no toque borde */
        padding: 18px 25px; 
        border-bottom: 1px solid rgba(255,255,255,0.05); 
        color: white;
        display: block;
    }
    .nav-links > a:last-child { border-bottom: none; }
    
    /* BUSCADOR MÓVIL */
    .mobile-search-container { 
        display: block !important; 
        width: 100%; 
        margin-bottom: 20px; 
        padding: 0 25px; /* Alineado con los textos */
    }
    
    .nav-search-input {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        color: white !important;
    }

    /* DROPDOWN GÉNEROS (Contenedor) */
    .dropdown { 
        width: 100%; 
        display: block; 
        border-bottom: 1px solid rgba(255,255,255,0.05); 
        padding: 0; 
    }
    
    /* El enlace "Géneros" */
    .dropdown > a { 
        border: none; 
        padding: 18px 25px; /* Misma alineación que los otros */
        display: flex; 
        justify-content: space-between;
        width: 100%;
        color: white;
        font-weight: 600;
        font-size: 18px;
    }
    
    /* SUBMENÚ (Corrección de alineación) */
    .dropdown-menu { 
        position: static; 
        transform: none; 
        background: rgba(0,0,0,0.2); /* Fondo un poco más oscuro */
        border: none; 
        padding: 5px 0; 
        display: none; 
        opacity: 1; visibility: visible; width: 100%; box-shadow: none; 
    }
    
    .dropdown.active .dropdown-menu { display: block; margin-left: 130px;}
    
    /* Ítems del Submenú */
    .dropdown-menu a { 
        font-size: 15px; 
        color: #b0b0b0; /* Gris claro legible */
        /* Padding Izquierdo: 45px para que se note la jerarquía */
        padding: 12px 25px 12px 45px; 
        border-bottom: 1px solid rgba(255,255,255,0.02);
        display: block;
        border-radius: 0;
        width: 100%;
    }
    
    .dropdown-menu a:hover {
        background-color: rgba(255,255,255,0.05);
        color: white;
    }

    /* Layout Responsive General */
    .contenedor-catalogo { grid-template-columns: 1fr; width: 100%; padding: 0 20px; }
    .seccion-lateral { margin-top: 40px; }
    .hero-titulo { font-size: 32px; }
    .footer-container { grid-template-columns: 1fr; text-align: center; }
    .social-links { justify-content: center; }
    .detail-hero { align-items: flex-start; padding-top: 100px; height: auto; }
    .detail-content { flex-direction: column; align-items: center; text-align: center; gap: 30px; }
    .detail-poster { width: 220px; }
    .meta-row, .genres-list, .action-buttons { justify-content: center; flex-wrap: wrap; }
    .detail-title { font-size: 32px; }
    .favorites-header { flex-direction: column; text-align: center; gap: 20px; padding: 30px; }
    .btn-clear-all { width: 100%; }
}