/* =========================================
   VARIABLES Y CONFIGURACIÓN BASE
   ========================================= */
:root {
    --nova-bg: #0a0a0f;
    --nova-accent: #00d2ff;
    --nova-accent-rgb: 0, 210, 255;
    --nova-accent-secondary: #3a7bd5;
    --nova-text: #ffffff;
    --nova-text-muted: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* =========================================
   GRID DE CATÁLOGO (CORREGIDO)
   ========================================= */
#catalog-grid {
    display: grid !important;
    gap: 1.5rem;
    padding: 1rem;
    /* Espacio extra abajo para que la paginación no tape las últimas pelis */
    padding-bottom: 150px;
    width: 100%;
    box-sizing: border-box;
    /* Fuerza el mismo comportamiento del index */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

@media (max-width: 480px) {
    #catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.8rem;
        padding: 0.5rem;
        padding-bottom: 120px;
    }
}

/* =========================================
   PAGINACIÓN FIJA (FOOTER)
   ========================================= */
.pagination-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 1.5rem 1rem;
    background: linear-gradient(to top,
            rgba(10, 10, 15, 1) 0%,
            rgba(10, 10, 15, 0.9) 60%,
            transparent 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    pointer-events: none;
    /* No bloquea el scroll del grid */
}

.pagination-wrapper {
    pointer-events: auto;
    /* Reactiva clicks en botones */
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.nova-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--nova-text);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nova-button:hover {
    background: var(--nova-accent);
    color: #000;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(var(--nova-accent-rgb), 0.4);
}

.nova-button.active {
    background: linear-gradient(135deg, var(--nova-accent) 0%, var(--nova-accent-secondary) 100%);
    color: white;
    border-color: transparent;
}

.nav-arrow {
    background: rgba(var(--nova-accent-rgb), 0.15) !important;
    color: var(--nova-accent) !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .nav-text {
        display: none;
    }

    /* Oculta texto "Siguiente" en móvil */
    .nova-button {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
    }
}

.home-card {
    position: relative;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.home-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.3);
}

/* Wrapper de imagen */
.home-card-image-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
}

/* Imagen */
.home-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.home-card:hover .home-card-image {
    transform: scale(1.05);
}

/* Badges - pequeños cuadritos en esquinas */
.home-badge {
    position: absolute;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
    color: #fff;
    backdrop-filter: blur(4px);
}

/* Badge NUEVO - arriba izquierda (rojo/naranja) */
.badge-nuevo {
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Badge HD - arriba derecha */
.badge-hd {
    top: 8px;
    right: 8px;
    background: rgba(0, 229, 255, 0.9);
    color: #000;
}

/* Info Temporada/Episodio - abajo izquierda */
.home-info {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10;
}

/* Overlay de play - aparece en hover */
.home-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
}

.home-card:hover .home-play-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* Botón de play */
.home-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.home-card:hover .home-play-btn {
    background: rgba(0, 229, 255, 0.9);
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.3);
}

.home-play-btn i {
    color: #fff;
    font-size: 18px;
    margin-left: 3px;
}

/* Contenido debajo de imagen */
.home-card-content {
    padding: 12px;
    background: rgba(30, 41, 59, 0.8);
}

/* Título */
.home-card-title {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.home-card:hover .home-card-title {
    color: #00e5ff;
}

/* Responsive */
@media (max-width: 640px) {
    .home-badge {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .home-info {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .home-play-btn {
        width: 40px;
        height: 40px;
    }
    
    .home-play-btn i {
        font-size: 14px;
    }
    
    .home-card-content {
        padding: 8px;
    }
    
    .home-card-title {
        font-size: 12px;
    }
}

/* ========================================
   SECCIONES HORIZONTALES (NUEVO)
   ======================================== */

.home-section {
    width: 100%;
}

.home-section-header {
    padding: 0 0 12px 0;
    border-bottom: 2px solid rgba(0, 229, 255, 0.2);
    margin-bottom: 16px;
}

.home-section-header h2 {
    color: #f8fafc;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.home-section-header h2 i {
    color: #00e5ff;
    font-size: 20px;
}

/* Contenedor scroll horizontal */
.home-horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px 20px 4px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.5) transparent;
}

.home-horizontal-scroll::-webkit-scrollbar {
    height: 8px;
}

.home-horizontal-scroll::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

.home-horizontal-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.5);
    border-radius: 4px;
}

.home-horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.8);
}

/* Card horizontal */
.home-hcard {
    flex: 0 0 auto;
    width: 180px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.home-hcard:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.3);
}

/* Imagen de card horizontal */
.home-hcard-image-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.home-hcard-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.home-hcard:hover .home-hcard-image {
    transform: scale(1.05);
}

/* Badges en cards horizontales */
.home-hcard-badge {
    position: absolute;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.badge-rating {
    top: 8px;
    right: 8px;
    background: rgba(0, 229, 255, 0.9);
    color: #000;
}

.badge-year {
    top: 8px;
    left: 8px;
    background: rgba(30, 41, 59, 0.9);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Badge de tipo (Película, Serie, Anime, Dorama) */
.home-hcard-type {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.type-movie {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
}

.type-serie {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
}

.type-anime {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: #fff;
}

.type-dorama {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
}

/* Badges específicos para episodios */
.badge-nuevo-ep {
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.badge-hd-ep {
    top: 8px;
    right: 8px;
    background: rgba(0, 229, 255, 0.9);
    color: #000;
}

.badge-te-ep {
    top: 8px;
    right: 40px;
    background: rgba(139, 92, 246, 0.9);
    color: #fff;
}

/* Info Temporada/Episodio en cards horizontales */
.home-ep-info {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(139, 92, 246, 0.9);
    backdrop-filter: blur(4px);
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Overlay de play */
.home-hcard-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
}

.home-hcard:hover .home-hcard-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.home-hcard-play {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.home-hcard:hover .home-hcard-play {
    background: rgba(0, 229, 255, 0.9);
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.3);
}

.home-hcard-play i {
    color: #fff;
    font-size: 20px;
    margin-left: 3px;
}

/* Contenido de card horizontal */
.home-hcard-content {
    padding: 12px;
    background: rgba(30, 41, 59, 0.8);
}

.home-hcard-title {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.home-hcard:hover .home-hcard-title {
    color: #00e5ff;
}

/* Responsive para horizontal scroll */
@media (max-width: 768px) {
    .home-hcard {
        width: 140px;
    }
    
    .home-hcard-content {
        padding: 8px;
    }
    
    .home-hcard-title {
        font-size: 11px;
    }
    
    .home-hcard-badge {
        font-size: 8px;
        padding: 2px 6px;
    }
    
    .home-hcard-type {
        font-size: 8px;
        padding: 2px 6px;
    }
    
    .home-hcard-play {
        width: 40px;
        height: 40px;
    }
    
    .home-hcard-play i {
        font-size: 14px;
    }
    
    .home-section-header h2 {
        font-size: 18px;
    }
}