/* --- VARIABLES --- */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --accent: #38bdf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --white: #ffffff;
}

/* --- BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 3rem 1rem;
    text-align: center;
    border-bottom: 2px solid var(--accent);
    position: relative;
}
header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
header p { color: var(--text-muted); font-size: 1.1rem; }
header strong { color: var(--accent); }

header .fa-square-poll-horizontal {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 2em;
    cursor: pointer;
    color: var(--white);
}

/* --- BARRA DE FILTROS (GALERÍA) --- */
.filtros-bar {
    background: #1e293b;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.form-filtros {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
}
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.input-group label {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: bold;
    text-transform: uppercase;
}

/* Estilo para el botón Limpiar */
.btn-clear {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid var(--text-muted);
    border-radius: 5px;
    font-size: 0.9rem;
    transition: all 0.3s;
}
.btn-clear:hover {
    color: var(--white);
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
}

/* --- CONTENEDOR --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- GRID DE PELÍCULAS (GALERÍA) --- */
.grid-peliculas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    border-color: var(--accent);
}

.card-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.no-image {
    height: 400px;
    background: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.card-body { padding: 1.5rem; flex-grow: 1; }
.fecha { color: var(--accent); font-weight: bold; font-size: 0.85rem; }
.titulo { margin: 0.5rem 0; font-size: 1.3rem; color: var(--white); min-height: 3rem; }
.cine { font-size: 1rem; margin-bottom: 0.3rem; }
.ubicacion {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 1rem;
}
.info {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.8rem;
}

/* --- PAGINACIÓN Y SELECTS --- */
.paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagi-select-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

#selector-pagi {
    padding: 5px;
    min-width: auto; /* Para que no sea tan ancho como los de arriba */
    border-radius: 4px;
}
.btn-pagi {
    background-color: var(--accent);
    color: #0f172a;
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
}
.btn-pagi:hover { background-color: var(--white); transform: scale(1.05); }

.nav-pagina {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8em;
    margin-bottom: 3rem;
}
select {
    padding: 8px 12px;
    font-size: 16px;
    border: 2px solid var(--accent);
    border-radius: 5px;
    background-color: var(--white);
    color: #2c3e50;
    cursor: pointer;
}

/* --- ESTADÍSTICAS (stats.php) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
}
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--accent); display: block; }

.charts-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    align-items: start;
}
.table-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Tabla Top Cines */
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th { text-align: left; color: var(--text-muted); font-size: 0.8rem; padding-bottom: 10px; }
.stats-table td { padding: 12px 5px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.bar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.bar {
    height: 10px;
    background: var(--accent);
    border-radius: 5px;
    min-width: 2px;
}
.vis-number { font-weight: bold; color: var(--white); white-space: nowrap; }

/* Histórico años */
.years-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.year-item {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}
.y-number { display: block; font-weight: bold; color: var(--accent); }
.y-count { font-size: 0.7rem; color: var(--text-muted); }

/* --- FOOTER --- */
footer { text-align: center; padding: 3rem; color: var(--text-muted); background: #020617; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .charts-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    header h1 { font-size: 2rem; }
    .container { padding: 1rem; }
}

@media (max-width: 480px) {
    .grid-peliculas { grid-template-columns: 1fr; }
    .form-filtros { flex-direction: column; align-items: stretch; gap: 1rem; }
    .paginacion { flex-direction: column; gap: 1rem; }
    .nav-pagina { flex-direction: column; }
    .stat-card { padding: 1rem; }
    .btn-clear {width: 25%;}
}