/* ===================================
   ESTILOS MINIMALISTAS PARA SECCIONES DE PELÍCULAS
   =================================== */

/* Variables de diseño */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --text-primary: #ffffff;
    --text-secondary: #8a8a8a;
    --text-hover: #ffffff;
    --accent: #e50914;
    --card-bg: #1a1a1a;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Contenedor principal */
.container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 4%;
}

/* ===================================
   SECCIONES DE PELÍCULAS
   =================================== */

.movie-section {
    margin-bottom: 4rem;
    position: relative;
    padding: 0 3%;
}

.movie-section.recommended {
    margin-top: 3rem;
}

/* Header de sección */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

/* Enlace Ver Todo - Estilizado */
.view-all {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-subtle);
    border-radius: 2rem;
    transition: all 0.3s var(--transition-smooth);
    background: transparent;
    white-space: nowrap;
}

.view-all:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

/* ===================================
   CAROUSEL DE PELÍCULAS
   =================================== */

.movie-row {
    position: relative;
    margin: 0 -0.5rem;
}

.movie-row.with-nav {
    padding: 0 3.5rem;
}

.movie-carousel {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 0.75rem 0.5rem;
    margin: -0.5rem;
    scroll-padding: 0 0.5rem;
}

.movie-carousel::-webkit-scrollbar {
    display: none;
}

/* Fade suave en los bordes */
.movie-carousel::before,
.movie-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    pointer-events: none;
    z-index: 2;
}

.movie-carousel::before {
    left: 0;
    background: linear-gradient(to right, 
        var(--bg-primary) 0%, 
        transparent 100%);
}

.movie-carousel::after {
    right: 0;
    background: linear-gradient(to left, 
        var(--bg-primary) 0%, 
        transparent 100%);
}

/* Botones de navegación */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid var(--border-subtle);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.carousel-nav:hover {
    background: rgba(40, 40, 40, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}

.carousel-nav svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===================================
   TARJETAS DE PELÍCULAS
   =================================== */

.movie-card {
    flex: 0 0 auto;
    width: 185px;
    cursor: pointer;
    transition: transform 0.3s var(--transition-smooth);
    position: relative;
}

.movie-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.movie-poster {
    position: relative;
    width: 100%;
    padding-bottom: 141.5%; /* Aspect ratio 2:3 más preciso */
    overflow: hidden;
    border-radius: 0.375rem;
    background: var(--card-bg);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.movie-poster img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--transition-smooth);
}

/* Overlay con rating */
.movie-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.9) 0%, 
        rgba(0, 0, 0, 0.4) 30%,
        transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0.75rem;
}

.movie-rating {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.movie-rating::before {
    content: '★';
    color: #f5c518;
    font-size: 0.875rem;
}

/* Título de película */
.movie-title {
    margin-top: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.125rem;
    transition: color 0.2s ease;
    line-height: 1.4;
}

/* ===================================
   EFECTOS HOVER
   =================================== */

.movie-card:hover {
    transform: scale(1.05);
}

.movie-card:hover .movie-poster img {
    transform: scale(1.1);
}

.movie-card:hover .movie-overlay {
    opacity: 1;
}

.movie-card:hover .movie-title {
    color: var(--text-primary);
}

/* Focus para accesibilidad */
.movie-card:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 0.5rem;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Desktop grande */
@media (min-width: 1440px) {
    .movie-section {
        padding: 0 4%;
    }
    
    .movie-card {
        width: 200px;
    }
    
    .section-title {
        font-size: 1.875rem;
    }
    
    .movie-title {
        font-size: 0.875rem;
    }
    
    .movie-carousel {
        gap: 1.5rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .movie-section {
        margin-bottom: 3rem;
        padding: 0 2%;
    }
    
    .section-header {
        margin-bottom: 1.25rem;
    }
    
    .section-title {
        font-size: 1.375rem;
    }
    
    .movie-card {
        width: 160px;
    }
    
    .movie-carousel {
        gap: 1rem;
    }
    
    .movie-row.with-nav {
        padding: 0 2.5rem;
    }
    
    .carousel-nav {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .view-all {
        padding: 0.375rem 1rem;
        font-size: 0.8125rem;
    }
}

/* Móviles */
@media (max-width: 480px) {
    .movie-section {
        padding: 0 3%;
        margin-bottom: 2.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .view-all {
        font-size: 0.75rem;
        padding: 0.375rem 0.875rem;
    }
    
    .movie-card {
        width: 125px;
    }
    
    .movie-carousel {
        gap: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .movie-title {
        font-size: 0.75rem;
    }
    
    .movie-rating {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .movie-row.with-nav {
        padding: 0;
    }
    
    .carousel-nav {
        display: none;
    }
}

/* ===================================
   MODO TV - OPTIMIZACIONES
   =================================== */

.tv-mode .movie-card {
    transition: all 0.2s ease;
}

.tv-mode .tv-focused {
    transform: scale(1.1);
    z-index: 100;
}

.tv-mode .tv-focused .movie-overlay {
    opacity: 1;
}

.tv-mode .tv-focused .movie-poster {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    border: 2px solid var(--text-primary);
}

/* ===================================
   ANIMACIONES SUTILES
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.movie-section {
    animation: fadeIn 0.6s ease backwards;
}

.movie-section:nth-child(1) { animation-delay: 0.1s; }
.movie-section:nth-child(2) { animation-delay: 0.2s; }
.movie-section:nth-child(3) { animation-delay: 0.3s; }
.movie-section:nth-child(4) { animation-delay: 0.4s; }
.movie-section:nth-child(5) { animation-delay: 0.5s; }
.movie-section:nth-child(6) { animation-delay: 0.6s; }

/* ===================================
   MEJORAS DE RENDIMIENTO
   =================================== */

.movie-poster img {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.movie-card {
    will-change: transform;
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .movie-carousel {
        scroll-behavior: auto;
    }
}

/* ===================================
   TEMA OSCURO (por defecto)
   =================================== */

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f5f5f5;
        --text-primary: #000000;
        --text-secondary: #666666;
        --card-bg: #f0f0f0;
        --border-subtle: rgba(0, 0, 0, 0.1);
    }
    
    .carousel-nav {
        background: rgba(255, 255, 255, 0.9);
        color: var(--text-primary);
    }
    
    .movie-overlay {
        background: linear-gradient(to bottom, 
            transparent 0%, 
            transparent 60%, 
            rgba(255, 255, 255, 0.9) 100%);
    }
    
    .movie-rating {
        background: rgba(255, 255, 255, 0.9);
    }
}