/* --- La Solución Universal --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Estilos Generales y Paleta de Colores */
:root {
    --color-primario: #141414;
    --color-secundario: #e50914;
    --color-texto-principal: #ffffff;
    --color-texto-secundario: #a0a0a0;
    --fuente-principal: 'Poppins', sans-serif; /* <-- Nueva Fuente */
}

body {
    font-family: var(--fuente-principal);
    background-color: var(--color-primario);
    color: var(--color-texto-principal);
    margin: 0;
    padding: 0;
}

main {
    padding-top: 100px;
}


/* Encabezado y Navegación */
.header {
    background-color: rgba(20, 20, 20, 0.8);
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--color-secundario);
    text-decoration: none;
}

.nav a {
    color: var(--color-texto-principal);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.3s ease;
}

.nav a:hover, .nav a.activo {
    color: var(--color-secundario);
}

/* Catálogo de Películas y Series */
.catalog {
    padding-bottom: 40px;
}

.catalog h2 {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 25px;
    padding-left: 50px; 
}

/* --- ESTILOS DE CUADRÍCULA Y TARJETAS MODERNAS --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    padding: 0 50px;
}

.movie-card {
    background-color: #222;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    aspect-ratio: 2 / 3;
}

.movie-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.movie-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 20%, transparent);
    color: white;
    transition: opacity 0.4s ease;
}

.card-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
    font-weight: 700;
}

.card-info .genre-tag {
    font-size: 0.8em;
    background-color: var(--color-secundario);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s ease;
    text-align: center;
}
.card-overlay .card-description {
    font-size: 0.9em;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.movie-card:hover .card-overlay {
    opacity: 1;
}

.movie-card:hover .card-info {
    opacity: 0;
}

/* --- ESTILOS MODERNOS PARA PÁGINAS DE REPRODUCTOR --- */
.player-main-container {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.details-view {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.details-poster {
    flex-shrink: 0;
    width: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.details-text h1 {
    font-size: 3em;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--color-texto-principal);
}

.details-text .rating {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.details-text .rating-badge {
    background-color: var(--color-secundario);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
}

.details-text .description {
    font-size: 1.1em;
    line-height: 1.7;
    color: var(--color-texto-secundario);
}

.play-button-container {
    margin-top: 30px;
}

.play-button {
    background-color: var(--color-secundario);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    font-family: var(--fuente-principal);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.play-button:hover {
    background-color: #ff1a25;
    transform: scale(1.05);
}

/* .video-view ruleset removed because it was empty */

.hidden {
    display: none !important;
}

.video-wrapper { 
    position: relative; 
    padding-bottom: 56.25%; 
    height: 0; 
    background-color: #000; 
    border-radius: 8px; 
    overflow: hidden; 
}
.video-wrapper video { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
}

.selectors-container { 
    margin-top: 25px; 
    display: flex; 
    gap: 20px; 
}
.selector-group { 
    display: flex; 
    flex-direction: column; 
}
.selector-group label { 
    margin-bottom: 8px; 
    font-size: 0.9em; 
    color: var(--color-texto-secundario); 
}
.selector-group select {
    background-color: #333; 
    color: var(--color-texto-principal); 
    border: 1px solid #555; 
    border-radius: 5px; 
    padding: 10px 15px; 
    font-size: 1em; 
    cursor: pointer; 
    width: 100%; 
}
.selectors-container .selector-group:last-child { 
    flex-grow: 1; 
}
.selector-group select:focus { 
    outline: none; 
    border-color: var(--color-secundario); 
}

/* --- Diseño Responsivo --- */
@media (max-width: 768px) {
    .header { padding: 20px 30px; }
    .catalog h2 { padding-left: 30px; }
    .grid-container {
        padding: 0 30px;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    .details-view {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .details-poster {
        width: 100%;
        max-width: 400px;
        margin-bottom: 20px;
    }
    .details-text .rating {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    main {
        padding-top: 180px;
    }
    .header {
        flex-direction: column; justify-content: flex-start; padding: 15px;
    }
    .logo { margin-bottom: 15px; }
    .nav {
        margin-top: 10px; display: flex; flex-wrap: wrap; justify-content: center;
    }
    .nav a { margin: 0 10px; padding: 8px; }
    .catalog h2 { font-size: 1.5em; padding-left: 20px; }
    .grid-container {
        padding: 0 20px;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    .selectors-container { flex-direction: column; gap: 15px; }
    .details-text h1 { font-size: 2.2em; }
}

/* --- ESTILOS PARA "VER MÁS" Y PÁGINAS DE GÉNERO --- */

.genre-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 50px;
    margin-bottom: 25px;
}

.genre-header h2 {
    margin: 0;
    padding: 0;
}

.ver-mas-btn {
    background-color: #333;
    color: var(--color-texto-principal);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.ver-mas-btn:hover {
    background-color: var(--color-secundario);
}

.page-title {
    font-size: 3em;
    font-weight: 700;
    padding: 0 50px;
    margin-bottom: 30px;
}

/* --- Ajustes responsivos para los nuevos estilos --- */
@media (max-width: 768px) {
    .genre-header, .page-title {
        padding: 0 30px;
    }
}

@media (max-width: 480px) {
    .genre-header, .page-title {
        padding: 0 20px;
    }
    .page-title {
        font-size: 2.2em;
    }
}
/* --- ESTILOS PARA LA BARRA DE BÚSQUEDA --- */

.header {
    /* Nos aseguramos de que los elementos dentro del header se distribuyan bien */
    justify-content: space-between;
    gap: 30px;
}

.search-form {
    display: flex;
    align-items: center;
    background-color: rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 5px;
}

#search-input {
    background: transparent;
    border: none;
    color: white;
    padding: 5px 15px;
    font-family: var(--fuente-principal);
    font-size: 0.9em;
    width: 200px;
    transition: width 0.3s ease-in-out;
}

#search-input:focus {
    outline: none;
    width: 250px;
}

#search-input::placeholder {
    color: var(--color-texto-secundario);
}

.search-form button {
    background: var(--color-secundario);
    border: none;
    color: white;
    font-weight: bold;
    font-size: 0.8em;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-form button:hover {
    background-color: #ff1a25;
}


/* --- Ajustes Responsivos para la Búsqueda --- */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap; /* Permitimos que el header se divida en varias líneas */
        justify-content: center;
    }
    .search-form {
        order: 3; /* Hacemos que la barra de búsqueda aparezca al final en móvil */
        margin-top: 15px;
        width: 100%;
    }
    #search-input {
        width: 100%; /* El input ocupa todo el espacio disponible */
    }
    #search-input:focus {
        width: 100%;
    }
}