/* 
   PANEL DE FILTROS EXPANDIBLE
    */

.panel-filtros {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

/* Botón "Más Filtros" */
.btn-mas-filtros {
    background: #c45100;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
    font-size: 14px;
    width: 100%;
}

.btn-mas-filtros:hover {
    background: #9a3b00;
}

.btn-mas-filtros:active {
    transform: scale(0.98);
}

/* Container de filtros */
.filtros-contenedor {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    animation: slideDown 0.9s ease;
}

.filtros-contenedor.abierto {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Secciones de filtros */
.filtros-seccion {
    margin-bottom: 20px;
}

.filtros-seccion:last-child {
    margin-bottom: 0;
}

.filtros-title {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Container de items */
.filtros-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Labels de filtros */
.filtro-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: color 0.2s ease;
    user-select: none;
}

.filtro-label:hover {
    color: #c45100;
}

.filtro-label input {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #c45100;
}

/* 
   RANGO DE PRECIOS CON SLIDER
    */

.rango-precio {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Slider (input range) */
.slider-precio {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Thumb del slider (la bola que mueves) */
.slider-precio::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c45100;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-precio::-webkit-slider-thumb:hover {
    background: #9a3b00;
    transform: scale(1.1);
}

.slider-precio::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #c45100;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-precio::-moz-range-thumb:hover {
    background: #9a3b00;
}

/* Track del slider (la barra) */
.slider-precio::-moz-range-track {
    background: transparent;
    border: none;
}

.slider-precio::-moz-range-progress {
    background: #c45100;
    height: 6px;
    border-radius: 3px;
}

/* Display del precio */
.precio-display {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

.precio-min {
    font-weight: bold;
    color: #333;
}

.precio-max {
    font-weight: bold;
    color: #c45100;
}

#precio-valor {
    color: #c45100;
}

/* 
   CONTADOR DE PRODUCTOS
    */
.contador-productos {
    text-align: right;
    width: auto;
    padding: 0 2rem;
    /* Alineado con el padding de tu layout */
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* 
   RESPONSIVE
    */

@media (max-width: 768px) {
    .panel-filtros {
        margin: 15px 0;
        padding: 12px;
    }

    .btn-mas-filtros {
        width: 100%;
        padding: 10px;
        font-size: 13px;
    }

    .filtros-contenedor {
        margin-top: 12px;
        padding: 12px;
    }

    .filtros-seccion {
        margin-bottom: 15px;
    }

    .filtros-title {
        font-size: 12px;
    }

    .filtro-label {
        font-size: 13px;
    }

    .precio-display {
        font-size: 12px;
    }

    .contador-productos {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .panel-filtros {
        margin: 10px 0;
        padding: 10px;
    }

    .filtros-contenedor {
        padding: 10px;
    }

    .filtro-label {
        font-size: 12px;
    }

    .filtros-title {
        font-size: 11px;
    }

    .slider-precio {
        height: 5px;
    }

    .slider-precio::-webkit-slider-thumb {
        width: 16px;
        height: 16px;
    }

    .slider-precio::-moz-range-thumb {
        width: 16px;
        height: 16px;
    }
}


/* 
   LAYOUT DEL CATÁLOGO: sidebar colapsable + grid
    */

.catalogo-layout {
    padding: 1rem 2rem;
}

/* Botón toggle estilo Natura */
.btn-toggle-filtros {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: #c45100;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(244, 121, 32, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

.btn-toggle-filtros:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 121, 32, 0.4);
}


/* El sidebar usa overflow:hidden para que su contenido no se salga cuando la columna es 0 */
.panel-filtros {
    position: relative;
    z-index: 20;
    overflow: hidden;
    transition: all 0.4s ease;
    /* Truco de invisibilidad */
    opacity: 0;
    pointer-events: none;
}

/* Cuando el catálogo tiene los filtros abiertos */
.catalogo-contenedor.filtros-abiertos .panel-filtros {
    opacity: 1;
    pointer-events: auto;
}

.panel-filtros-inner {
    width: 280px;
    position: sticky;
    top: 1rem;
    background: white;
    z-index: 30;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #eee;
    /* Evita que el contenido se mueva mientras el panel se cierra */
    visibility: hidden;
}

.catalogo-contenedor.filtros-abiertos .panel-filtros-inner {
    visibility: visible;
}

.filtro-grupo {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.filtro-grupo:last-child {
    border-bottom: none;
}

.filtro-grupo h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: #333;
}

.filtro-grupo label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    transition: color 0.2s;
    position: relative;
    z-index: 3001;
    /* para que esté por encima del panel */
}

.filtro-grupo label:hover {
    color: #c45100;
}

/* El check en sí */
.filtro-grupo input[type="checkbox"] {
    accent-color: #c45100;
    /* Color naranja Natura */
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Tarjeta oculta por filtros */
.producto-card.card-oculta {
    display: none !important;
}


/* Asegura que el grid de productos use el espacio sobrante (1fr) */
.catalogo-contenedor {

    display: grid;
    grid-template-columns: 0fr 1fr;
    /* Columna de filtros inicia en 0 */
    gap: 0;
    transition: grid-template-columns 0.7s ease, gap 0.7s ease;
    align-items: start;
}

/* Cuando se abre el panel, el grid de productos se reduce automáticamente */
.catalogo-contenedor.filtros-abiertos {
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Configuración de las tarjetas para que se muevan */
.productos-grid {
    display: grid;
    /* Esto hace que las tarjetas se acomoden solas: si hay espacio pone 4, si no pone 3 */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}


/* Contenedor para alinear todo en una fila */
.catalogo-opciones {
    display: flex;
    justify-content: space-between;
    /* Botón a la izquierda, contador a la derecha */
    align-items: center;
    /* Centrados verticalmente */
    flex-wrap: wrap;
    /* Para que en celular no se rompa */
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

/* Agrupamos Botón y el selector "Ordenar por" a la izquierda */
.catalogo-controles-izquierda {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Estilo para el selector Ordenar por */
.ordenar-precio {
    padding: 8px 12px;
    border: 1px solid #c45100;
    /* Color Natura */
    border-radius: 20px;
    outline: none;
    cursor: pointer;
    background: white;
    font-size: 14px;
}

.ordenar-precio:hover {
    border-color: #9a3b00;
}

.btn-reset {
    background: transparent;
    border: none;
    color: #c45100;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s ease;
}

/* Ajuste para que los filtros se vean ordenados */
.filtro-grupo {
    display: flex;
    flex-direction: column;
    /* Pone uno debajo del otro */
    gap: 8px;
    margin-bottom: 20px;
    padding: 10px;
    border: none;
}

.filtro-grupo h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
    border-bottom: 2px solid #c45100;
    /* Línea naranja Natura */
    padding-bottom: 5px;
}

.filtro-grupo label {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Espacio entre el cuadro y el texto */
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.filtro-grupo label:hover {
    color: #c45100;
}

/* Personalización del checkbox (opcional pero recomendado) */
.filtro-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #c45100;
    /* Color naranja Natura para el check */
}

/* Quita los estilos por defecto del fieldset para que parezca un div */
fieldset.filtro-grupo {
    z-index: 3000;
    /* para que esté por debajo de los labels */
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

/* Quita el estilo por defecto del legend */
fieldset.filtro-grupo legend {
    z-index: 3001;
    /* para que esté por encima del fieldset */
    font-size: 1.1rem;
    padding: 0;
    margin: 0;
    display: block;
    width: 100%;
}