/* =========================================
   1. VARIABLES Y RESET
   ========================================= */
:root {
    --accent: #00f2ff;
    --neon: #ff007b;
    --bg: #050505;
    --warning: #ffcc00;
    --gold: #ffcc00;
    --card-bg: #0f0f0f;
    --border: #1a1a1a;
    --transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: white;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =========================================
   2. SIDEBAR NAVIGATION
   ========================================= */
.sidebar {
    width: 90px;
    background: #000;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30px;
    border-right: 1px solid var(--border);
    gap: 30px;
    z-index: 1100;
    transition: width 0.3s ease;
}

.sidebar-item {
    color: #666;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.65rem;
    transition: var(--transition);
    text-transform: uppercase;
    font-weight: 600;
    width: 100%;
    padding: 10px 0;
}

.sidebar-item iconify-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.sidebar-item:hover, 
.sidebar-item.active {
    color: var(--accent);
    background: rgba(0, 242, 255, 0.05);
    box-shadow: inset 4px 0 0 var(--accent);
}

/* =========================================
   3. MAIN WRAPPER & HEADER
   ========================================= */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

header {
    padding: 20px 6%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(15px);
    display: flex; /* CAMBIA ESTO */
    justify-content: space-between; /* CAMBIA ESTO */
    align-items: center; /* CAMBIA ESTO */
    position: sticky;
    top: 0; 
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}
.logo { 
    font-size: 1.8rem; 
    font-weight: 900; 
    cursor: pointer; 
    letter-spacing: -1px;
}

.logo span { 
    color: var(--accent); 
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.5); 
}

.search-container {
    display: flex;
    align-items: center;
    background: #121212;
    padding: 10px 18px;
    border-radius: 30px;
    border: 1px solid #222;
    transition: 0.3s;
}

.search-container:focus-within { 
    border-color: var(--accent); 
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

.search-input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 200px;
    font-size: 0.9rem;
}

/* =========================================
   4. GRID & MOVIE CARDS
   ========================================= */
#main-content {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, 240px); 
    gap: 30px;
    padding: 40px 6%;
    justify-content: center;
    align-items: start;
}

.movie-card {
    background: var(--card-bg); 
    border-radius: 12px; 
    overflow: hidden; 
    cursor: pointer; 
    transition: var(--transition); 
    border: 1px solid var(--border);
    position: relative;
    height: 100%;
    animation: fadeIn 0.6s ease forwards;
}

.movie-card:hover { 
    transform: translateY(-10px) scale(1.02); 
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.movie-card img { 
    width: 100%; 
    height: 350px; 
    object-fit: cover;
    transition: 0.5s ease;
}

.movie-card:hover img {
    filter: brightness(0.4);
}

.movie-info {
    padding: 15px;
}

.movie-info h3 {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Etiqueta Premium */
.badge-premium {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #8a2be2; /* Morado intenso */
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.7);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   ESTILOS EXCLUSIVOS PARA COMPRA.HTML
   ========================================= */

.purchase-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Fondo radial profundo */
    background: radial-gradient(circle at center, #1a0b2e 0%, #050505 100%);
    overflow: hidden;
    position: relative;
}

/* Luces de fondo decorativas */
.purchase-container::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: #8a2be2;
    filter: blur(150px);
    opacity: 0.2;
    top: 10%;
    left: 10%;
}

.purchase-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 60px 40px;
    border-radius: 40px;
    border: 1px solid rgba(138, 43, 226, 0.4);
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
    animation: fadeInCard 0.8s ease-out;
}

/* Animación del Diamante Premium */
.diamond-glow {
    font-size: 6rem;
    color: #8a2be2;
    filter: drop-shadow(0 0 20px #8a2be2);
    margin-bottom: 25px;
    animation: float 3s ease-in-out infinite;
}

.purchase-card h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 2.8rem;
    color: white;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.purchase-card p {
    color: #b3b3b3;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 40px;
}

/* Estilizar el contenedor del botón de Stripe */
stripe-buy-button {
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

stripe-buy-button:hover {
    transform: scale(1.02);
}

.back-link {
    margin-top: 30px;
    display: inline-block;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: #8a2be2;
}

/* =========================================
   ANIMACIONES
   ========================================= */

@keyframes float {
    0%, 100% { transform: translateY(0px); filter: drop-shadow(0 0 15px #8a2be2); }
    50% { transform: translateY(-15px); filter: drop-shadow(0 0 30px #bd00ff); }
}

@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Decoración de "Beneficios" */
.premium-features {
    text-align: left;
    margin: 20px 0 30px 0;
    padding: 0;
    list-style: none;
    display: inline-block;
}

.premium-features li {
    color: #ddd;
    margin-bottom: 10px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-features li iconify-icon {
    color: #8a2be2;
}

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 15px; /* Esto los pone uno al lado del otro */
}

/* Botón Premium en el Header */
.premium-btn-nav {
    background: #8a2be2;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.6);
    transition: 0.3s;
    margin-right: 15px;
}

.premium-btn-nav:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(138, 43, 226, 0.9);
}

/* Colores del Perfil */
.user-icon { font-size: 24px; transition: 0.3s; }
.premium-user-icon { color: #8a2be2; filter: drop-shadow(0 0 5px #8a2be2); }
.standard-user-icon { color: white; }

/* Sistema de Notificaciones (Toast) */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: #1a1a1a;
    border-left: 5px solid #8a2be2;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal de Compra Premium */
.premium-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

.premium-card {
    background: linear-gradient(145deg, #1a0b2e, #050505);
    padding: 40px;
    border-radius: 25px;
    border: 2px solid #8a2be2;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.premium-card h2 { color: #fff; margin-top: 15px; }
.coming-soon-badge { border: 2px dashed #8a2be2; padding: 15px; color: #8a2be2; font-weight: 900; animation: pulse 2s infinite; }
.premium-card p { color: #ccc; margin: 20px 0; line-height: 1.6; }

.btn-buy { background: #8a2be2; color: white; border: none; padding: 12px 25px; border-radius: 10px; font-weight: bold; cursor: pointer; width: 100%; margin-bottom: 10px; transition: 0.3s; }
.btn-buy:hover { transform: scale(1.05); box-shadow: 0 0 20px #8a2be2; }
.btn-cancel { background: transparent; color: #666; border: none; cursor: pointer; text-decoration: underline; }

/* --- ACTUALIZA ESTAS REGLAS EN TU SERIES.HTML --- */

.badge-serie {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--accent);
    color: black;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.6);
    z-index: 10;
    letter-spacing: 1px;
}

.series-container { 
    padding: 20px 4%; 
    max-width: 1400px; /* Aumentamos el ancho máximo */
    margin: auto; 
    padding-bottom: 100px;
}

.video-container {
    width: 100%; 
    position: relative;
    aspect-ratio: 16 / 9; /* Esto obliga al video a mantener formato panorámico */
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.1); /* Un pequeño brillo neón */
    border: 1px solid #222;
}

#series-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.episodes-section { 
    margin-top: 20px; 
    background: linear-gradient(145deg, #0f0f0f, #050505); 
    border-radius: 20px; 
    padding: 25px; 
    border: 1px solid var(--border); 
}

/* Ajuste opcional para que los capítulos se vean más "Premium" */
.episode-item {
    border-bottom: 1px solid #1a1a1a;
    padding: 15px;
    margin-bottom: 5px;
}

/* =========================================
   5. CARD OVERLAYS & BUTTONS
   ========================================= */
.info-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #0084ff;
    font-size: 1.8rem;
    z-index: 10;
    filter: drop-shadow(0 0 5px black);
}

.like-btn {
    position: absolute;
    bottom: 85px; 
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.1);
    transition: 0.3s;
}

.like-btn iconify-icon { font-size: 1.5rem; }

.like-btn:hover { transform: scale(1.2); }

.like-btn.active { 
    color: #ff0055; 
    border-color: #ff0055; 
    background: rgba(255, 0, 85, 0.1);
}

.movie-info-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    padding: 25px;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s ease;
    z-index: 5;
}

.movie-info-overlay.visible { opacity: 1; pointer-events: all; }

/* =========================================
   6. AUTH SYSTEM UI
   ========================================= */
.auth-open-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.3s;
}

.auth-open-btn:hover {
    background: var(--accent);
    color: black;
    box-shadow: 0 0 20px var(--accent);
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.auth-card {
    background: linear-gradient(145deg, #0f0f0f, #050505);
    padding: 40px;
    border-radius: 25px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(0, 242, 255, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    text-align: center;
    animation: authShow 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes authShow {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-card h2 { font-size: 1.8rem; margin-bottom: 25px; color: #fff; }

.input-group { text-align: left; margin-bottom: 20px; }

.input-group label {
    display: block; font-size: 0.75rem; color: var(--accent);
    margin-bottom: 8px; text-transform: uppercase; font-weight: 700;
}

.input-group input {
    width: 100%; background: rgba(255, 255, 255, 0.03);
    border: 1px solid #222; padding: 14px; border-radius: 12px;
    color: white; outline: none; transition: 0.3s;
}

.input-group input:focus { border-color: var(--accent); background: rgba(0, 242, 255, 0.05); }

.main-btn {
    width: 100%; background: var(--accent); color: #000;
    border: none; padding: 15px; border-radius: 12px;
    font-weight: 800; cursor: pointer; transition: 0.3s; text-transform: uppercase;
}

.main-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 242, 255, 0.4); }

.close-btn-auth {
    position: absolute; top: 15px; right: 15px; background: none;
    border: none; color: #555; font-size: 1.5rem; cursor: pointer;
}

.auth-switch { margin-top: 20px; font-size: 0.85rem; color: #777; }
.auth-switch span { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* Perfil de usuario en header */
.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

/* =========================================
   7. REPRODUCTOR & OVERLAY
   ========================================= */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.98);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.overlay-content {
    width: 90%;
    max-width: 1000px;
    background: #000;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    position: relative;
}

.warning-box {
    background: rgba(255, 204, 0, 0.1);
    border: 1px solid var(--warning);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--warning);
}

.close-btn.top-right {
    position: absolute;
    top: 20px; right: 20px;
    background: #1a1a1a; border: 2px solid #333;
    color: white; width: 60px; height: 60px;
    border-radius: 50%; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    z-index: 3000; transition: 0.3s ease;
}

.close-btn.top-right:hover { background: var(--neon); transform: rotate(90deg); }

.video-container {
    width: 100%; aspect-ratio: 16 / 9;
    background: #000; border-radius: 12px;
    overflow: hidden; margin-bottom: 20px;
}

#video-player { width: 100%; height: 100%; border: none; }

/* =========================================
   8. FOOTER & EXTRAS
   ========================================= */
footer {
    padding: 60px 20px; text-align: center;
    background: #000; border-top: 1px solid var(--border);
    margin-top: 50px;
}

#cookie-banner {
    position: fixed; bottom: 20px; left: 20px; right: 20px;
    background: #111; border: 1px solid var(--accent);
    padding: 20px; border-radius: 15px; z-index: 9999;
    display: flex; justify-content: space-between; align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   9. RESPONSIVE DESIGN (EL MOTOR MÓVIL)
   ========================================= */
@media (max-width: 768px) {
    body { flex-direction: column; }

    .sidebar {
        width: 100%; height: 70px;
        flex-direction: row; position: fixed;
        bottom: 0; top: auto; padding: 0;
        justify-content: space-around;
        border-right: none; border-top: 1px solid var(--border);
        gap: 0;
    }

    .sidebar-item { font-size: 0.55rem; }
    .sidebar-item iconify-icon { font-size: 1.6rem; }
    .sidebar-item:hover, .sidebar-item.active { box-shadow: inset 0 4px 0 var(--accent); }

    header { padding: 15px 4%; flex-wrap: wrap; gap: 15px; }
    .logo { font-size: 1.4rem; }
    .search-container { order: 3; width: 100%; }
    .search-input { width: 100%; }

    #main-content {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px; padding: 20px 4% 100px 4%;
    }

    .movie-card img { height: 240px; }
    .like-btn { bottom: 70px; width: 35px; height: 35px; }
    
    .overlay-content { width: 95%; padding: 15px; }
    .close-btn.top-right { width: 45px; height: 45px; top: 10px; right: 10px; }
}

@media (max-width: 480px) {
    #main-content { grid-template-columns: 1fr 1fr; }
    .auth-card { padding: 25px 15px; }
}