/* --- Variables y Estilos Globales (Tema Claro) --- */
:root {
    --primary-bg: #F4F4F9;      /* Fondo principal (un gris muy claro) */
    --secondary-bg: #FFFFFF;    /* Fondo del encabezado y las tarjetas (blanco) */
    --card-bg: #FFFFFF;         /* Fondo de las tarjetas de película */
    --text-color: #121212;      /* Color de texto principal (negro) */
    --accent-color: #E50914;    /* Color de acento (se mantiene el rojo) */
    --highlight-color: #FBC02D; /* Color de realce (se mantiene el amarillo) */
    --border-color: #E0E0E0;    /* Un color suave para los bordes */
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
}

/* --- Encabezado --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color); /* Borde más sutil */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Sombra suave */
}

header .logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    height: 50px;
    width: auto;
}

header .logo h1 { 
    font-size: 1.8rem; 
}

#form { 
    width: 40%; 
}

#search {
    width: 100%;
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 1rem;
    background-color: #F4F4F9; /* Fondo claro para la barra de búsqueda */
    color: var(--text-color);
    transition: all 0.2s ease;
}

#search:focus { 
    outline: none; 
    border-color: var(--accent-color); 
}

/* --- Filtros de Género --- */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
}

.tag {
    background-color: var(--secondary-bg);
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag:hover { 
    background-color: #e9e9e9; 
}

.tag.active {
    background-color: var(--accent-color);
    color: white; /* Texto blanco para el tag activo */
    font-weight: bold;
    border-color: var(--accent-color);
}

/* --- Contenedor Principal y Películas --- */
main, .favorites-section { 
    padding: 0 2rem; 
}

h2 { 
    font-size: 1.8rem; 
    margin: 1.5rem 0; 
    color: #333;
}

.movie-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.movie {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.movie:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 12px rgba(0,0,0,0.1);
}

.movie img { 
    width: 100%; 
    display: block; 
}

.movie-info {
    padding: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.movie-info h3 { 
    font-size: 0.9rem; 
    color: var(--text-color);
}

.movie-info span { 
    font-weight: bold; 
    color: var(--text-color);
    background-color: #f4f4f4;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.movie-info span.green { background-color: #d4edda; color: #155724; }
.movie-info span.orange { background-color: #fff3cd; color: #856404; }
.movie-info span.red { background-color: #f8d7da; color: #721c24; }

/* --- Icono de Favorito --- */
.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--border-color);
    color: #333;
    font-size: 1.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    line-height: 40px;
    text-align: center;
}

.favorite-btn:hover { 
    transform: scale(1.2); 
    background-color: white;
}

.favorite-btn.active { 
    color: var(--accent-color); 
}

/* --- Paginación --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.page {
    padding: 0.5rem 1rem;
    margin: 0 0.3rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
}

.page.disabled { 
    cursor: not-allowed; 
    background: #e9ecef; 
}

.page.current { 
    border-color: var(--accent-color); 
    background-color: var(--accent-color);
    color: white;
    font-weight: bold; 
}

/* --- Modal de Detalles --- */
.modal-container { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    justify-content: center; 
    align-items: center; 
}

.modal { 
    background-color: var(--secondary-bg); 
    padding: 2rem; 
    border-radius: 10px; 
    width: 90%; 
    max-width: 650px; 
    position: relative; 
}

.close-modal { 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    color: #333; 
    font-size: 2rem; 
    border: none; 
    background: none; 
    cursor: pointer; 
}

/* --- Utilidades --- */
.message { 
    grid-column: 1 / -1; 
    text-align: center; 
    color: #888; 
}

/* --- Botón de Logout --- */
.logout-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 1rem;
}

.logout-btn:hover {
    background-color: #c40812;
}

/* --- Estilos para el Botón del Tráiler y Modales --- */
.play-trailer-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    margin-top: 1rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.play-trailer-btn:hover {
    background-color: #c40812;
    transform: scale(1.05);
}

.video-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.video-modal {
    position: relative;
    width: 90%;
    max-width: 900px;
    transform: scale(0.8);
    animation: zoomIn 0.3s 0.1s forwards;
}

.video-modal iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 5px;
}

.close-video-modal {
    position: absolute;
    top: -45px;
    right: 0;
    font-size: 2.8rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-layout {
    display: flex;
    gap: 20px;
}
.modal-layout img {
    width: 150px;
    height: auto;
    flex-shrink: 0;
    border-radius: 5px;
}

/* Animaciones */
@keyframes fadeIn { to { opacity: 1; } }
@keyframes zoomIn { to { transform: scale(1); } }
footer {
    background-color: var(--secondary-bg); /* Fondo blanco, igual que el encabezado */
    color: #6c757d; /* Color de texto gris sutil */
    text-align: center;
    padding: 2rem;
    margin-top: 3rem; /* Espacio para separarlo del contenido de arriba */
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

footer p {
    margin-bottom: 0.5rem;}