/* ========================================= */
/* LAYOUT DE EXPLORACIÓN (BUSCADOR AVANZADO) */
/* ========================================= */

.explore-container {
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    box-sizing: border-box; /* Protege el contenedor principal */
}

/* --- BARRA LATERAL (SIDEBAR) --- */
.filter-sidebar {
    width: 300px;
    background-color: var(--surface); /* Tono gris oscuro de KoiFlix */
    border-radius: 12px;
    padding: 25px;
    flex-shrink: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid #333;
    position: sticky;
    top: 90px;
    box-sizing: border-box; /* LA SOLUCIÓN AL SCROLL HORIZONTAL */
}

.filter-group {
    margin-bottom: 22px;
}

.filter-group label {
    display: block;
    color: #ccc;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* --- SELECTORES PERSONALIZADOS --- */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '\25BC'; /* Flecha hacia abajo */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
    font-size: 0.8rem;
}

.filter-sidebar select {
    width: 100%;
    background-color: #252525; /* Fondo oscuro tipo Netflix */
    color: white;
    border: 1px solid #333;
    padding: 12px 15px;
    border-radius: 6px;
    appearance: none; 
    font-size: 0.95rem;
    outline: none;
    transition: 0.3s;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
}

.filter-sidebar select:focus, .filter-sidebar select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 77, 77, 0.2);
}

.filter-sidebar select option {
    background-color: var(--surface);
    color: white;
}

/* --- SLIDER DE AÑO (RANGE) --- */
.koi-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #333; /* Fondo de la pista gris */
    border-radius: 5px;
    outline: none;
    margin-top: 10px;
    box-sizing: border-box;
}

.koi-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary); /* Bolita roja KoiFlix */
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.5);
    transition: transform 0.2s;
}

.koi-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #888;
}

/* --- BOTONES DE ACCIÓN --- */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.btn-search-koi {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
    box-sizing: border-box;
}

.btn-search-koi:hover {
    background-color: #e60000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 77, 77, 0.5);
}

.btn-clear-koi {
    background-color: #252525;
    color: #ccc;
    border: 1px solid #444;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.btn-clear-koi:hover {
    background-color: #333;
    color: white;
}

/* --- ZONA DE RESULTADOS --- */
.results-section {
    flex: 1;
    min-width: 0;
}

/* ========================================= */
/* RESPONSIVE INTELIGENTE (CELULARES)        */
/* ========================================= */
@media (max-width: 900px) {
    .explore-container {
        flex-direction: column;
        margin: 20px auto;
        padding: 0 15px; /* Reducimos padding en móvil */
        overflow-x: hidden; /* Seguro extra anti-scroll */
    }
    
    .filter-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 20px;
        /* box-sizing ya viene heredado de arriba, pero por si acaso */
        box-sizing: border-box; 
    }

    .filter-group {
        margin-bottom: 0; 
        width: 100%;
    }

    .slider-group {
        grid-column: span 2; 
    }

    .filter-actions {
        grid-column: span 2;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .filter-sidebar {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    .slider-group, .filter-actions {
        grid-column: span 1;
    }
    .filter-actions {
        flex-direction: column;
    }
}

/* ========================================= */
/* PAGINACIÓN ESTILO KOIFLIX                 */
/* ========================================= */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 20px;
    background-color: var(--surface);
    padding: 10px;
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid #333;
}

.page-btn {
    background: transparent;
    color: #aaa;
    border: none;
    padding: 8px 15px;
    margin: 0 2px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.page-btn:hover:not(.active):not(.dots) {
    color: white;
    background-color: #333;
}

.page-btn.active {
    background-color: var(--primary);
    color: white;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.4);
}

.page-btn.dots {
    cursor: default;
    padding: 8px 10px;
    color: #666;
}

@media (max-width: 600px) {
    .page-btn { padding: 6px 10px; font-size: 0.9rem; }
}