/* --- Estilos para el Panel Modal de Filtros (Tablet y Móvil) --- */

/* El overlay que cubre toda la pantalla */
.jewel-finder-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    z-index: 10000;
}

.jewel-finder-modal-overlay.is-open {
    display: flex;
}

/* El contenido del panel */
#jewel-finder-modal .jewel-finder-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 20px;
}

#jewel-finder-modal .jewel-finder-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

#jewel-finder-modal .jewel-finder-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

#jewel-finder-modal .jewel-finder-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
}

#jewel-finder-modal .jewel-finder-modal-body {
    overflow-y: auto;
}

/* --- INICIO DE LA CORRECCIÓN DE ESPECIFICIDAD --- */
/* Reglas de cuadrícula para las categorías DENTRO del modal */
#jewel-finder-modal .jewel-finder-categories {
    display: grid !important; /* Forzamos la cuadrícula para ganar a cualquier otra regla */
    gap: 10px;
    width: 100%;
}

/* Ajustamos el tamaño de los botones para que se adapten a la cuadrícula */
#jewel-finder-modal .category-button {
    width: auto;
    height: auto;
    min-height: 120px;
}

/* Columnas para tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    #jewel-finder-modal .jewel-finder-categories {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Columnas para móvil */
@media (min-width: 481px) and (max-width: 768px) {
    #jewel-finder-modal .jewel-finder-categories {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Columnas para móvil pequeño */
@media (max-width: 480px) {
    #jewel-finder-modal .jewel-finder-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* --- FIN DE LA CORRECCIÓN DE ESPECIFICIDAD --- */


/* Evita el scroll del body principal cuando el modal está abierto */
body.jewel-finder-modal-active {
    overflow: hidden;
}

/* REGLAS DE VISIBILIDAD (NO CAMBIAN) */
#jewel-finder-mobile-filter-trigger { 
    display: none;
}

@media (max-width: 1024px) {
    #jewel-finder-mobile-filter-trigger {
        display: flex !important;
        width: 100%;
        max-width: 500px;
        padding: 12px;
        font-size: 1rem;
        font-weight: 600;
        justify-content: center;
        background-color: #111;
        color: #fff;
        border: none;
        border-radius: 5px;
    }

    /* Ocultamos el panel de categorías de escritorio en esta vista */
    #jewel-finder-categories-panel {
        display: none !important;
    }
}