/* =========================================
   RESULTADOS DE BÚSQUEDA — con panel filtros
   ========================================= */

/* ---- Layout principal: sidebar + contenido ---- */
.res-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    align-items: start;
}

/* =========================================
   SIDEBAR DE FILTROS
   ========================================= */
.res-sidebar {
    position: sticky;
    top: 1.5rem;
}

.res-filters-panel {
    background: var(--blanco);
    border: 1px solid #E8EFF6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

/* Cabecera del panel */
.res-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--azul-marino);
    color: var(--blanco);
}

.res-filters-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.res-filters-header h2 i {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Botón limpiar */
.res-btn-clear {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.85);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.res-btn-clear:hover {
    background: rgba(255,255,255,0.15);
    color: var(--blanco);
}

/* ---- Sección dentro del panel ---- */
.res-filter-section {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #E8EFF6;
}
.res-filter-section:last-child {
    border-bottom: none;
}

.res-filter-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--azul-marino);
    margin: 0 0 0.85rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.res-filter-title i {
    color: var(--cian);
    font-size: 0.7rem;
}

/* ---- Rango de precio ---- */
.res-price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.res-price-tag {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--azul-marino);
    background: #F0F5FB;
    padding: 3px 10px;
    border-radius: 20px;
}

.res-price-sep {
    font-size: 0.7rem;
    color: var(--gris-medio);
}

/* Wrapper del slider doble */
.res-range-wrap {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
}

.res-range-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #E0E8F0;
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.res-range-fill {
    position: absolute;
    height: 4px;
    background: var(--cian);
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: left 0.05s, width 0.05s;
}

.res-range-wrap input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    outline: none;
}

.res-range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--azul-marino);
    border: 3px solid var(--blanco);
    box-shadow: 0 1px 6px rgba(0,0,0,0.25);
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.15s, box-shadow 0.15s;
}
.res-range-wrap input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.res-range-wrap input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--azul-marino);
    border: 3px solid var(--blanco);
    box-shadow: 0 1px 6px rgba(0,0,0,0.25);
    cursor: pointer;
    pointer-events: all;
}

/* ---- Checkboxes (categoría, marca, oferta) ---- */
.res-check-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 210px;
    overflow-y: auto;
    padding-right: 4px;
}

.res-check-list::-webkit-scrollbar {
    width: 4px;
}
.res-check-list::-webkit-scrollbar-track {
    background: #F0F5FB;
    border-radius: 2px;
}
.res-check-list::-webkit-scrollbar-thumb {
    background: #C0CDD8;
    border-radius: 2px;
}

.res-check-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    padding: 0.2rem 0;
}

.res-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--azul-marino);
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 3px;
}

.res-check-label {
    font-size: 0.82rem;
    color: var(--gris-oscuro);
    flex: 1;
    line-height: 1.3;
}

.res-check-count {
    font-size: 0.68rem;
    color: var(--gris-medio);
    background: #F0F5FB;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* Toggle oferta */
.res-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.res-toggle-label {
    font-size: 0.82rem;
    color: var(--gris-oscuro);
}
.res-toggle {
    position: relative;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}
.res-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.res-toggle-slider {
    position: absolute;
    inset: 0;
    background: #D0DCE8;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.25s;
}
.res-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.res-toggle input:checked + .res-toggle-slider {
    background: var(--cian);
}
.res-toggle input:checked + .res-toggle-slider::before {
    transform: translateX(18px);
}

/* Botón aplicar */
.res-btn-apply {
    display: block;
    width: 100%;
    padding: 0.65rem;
    background: var(--azul-marino);
    color: var(--blanco);
    border: none;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    border-radius: 0 0 12px 12px;
    margin-top: -1px;
}
.res-btn-apply:hover {
    background: var(--cian-oscuro, #0097a7);
}

/* =========================================
   COLUMNA DERECHA — cabecera y grid
   ========================================= */
.res-main {
    min-width: 0;
}

/* ---- Encabezado del catálogo ---- */
.res-header {
    margin-bottom: 1.5rem;
}

.res-header-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.res-header-icon {
    font-size: 1.1rem;
    color: var(--cian);
    flex-shrink: 0;
}

/*
 * Anular cualquier pseudo-elemento decorativo que el tema global
 * pueda inyectar sobre .section-title dentro del catálogo.
 * Si tu CSS global usa ::before, se anula aquí también.
 */
.res-header .section-title::before,
.res-header .section-title::after {
    display: none !important;
    content: none !important;
}

/* El título en sí: sin margen extra ni borde */
.res-header .section-title {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Parte coloreada del título (span.text-cian generado por PHP) */
.res-header .section-title .text-cian {
    color: var(--cian);
    font-style: italic;
}

.res-header-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.res-count {
    font-size: 0.88rem;
    color: var(--gris-medio);
    margin: 0;
}

/* Ordenamiento */
.res-sort-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.res-sort-label {
    font-size: 0.8rem;
    color: var(--gris-medio);
}

.res-sort-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid #D0DCE8;
    border-radius: 6px;
    color: var(--gris-oscuro);
    background: var(--blanco);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.res-sort-select:focus {
    border-color: var(--cian);
}

/* ---- Estado vacío ---- */
.res-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--gris-medio);
}
.res-empty i {
    font-size: 3.5rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}
.res-empty p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ---- Grid de cards ---- */
.res-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.res-grid--full {
    grid-template-columns: repeat(4, 1fr);
}

/* ---- Card ---- */
.res-card {
    background: var(--blanco);
    border: 1px solid #E8EFF6;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow 0.25s, transform 0.25s;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.res-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

/* Badge oferta */
.res-badge-oferta {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--rojo);
    color: var(--blanco);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Badge destacado */
.res-badge-destacado {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--cian);
    color: var(--blanco);
    font-size: 0.65rem;
    font-weight: 800;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Imagen */
.res-card-img-wrap {
    display: flex;
    background: #ffff;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.res-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}
.res-card:hover .res-card-img { transform: scale(1.05); }

/* Body */
.res-card-body {
    background: var(--gris-claro);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.4rem;
}

.res-card-cat {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gris-medio);
}

.res-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gris-oscuro);
    line-height: 1.35;
    flex: 1;
    margin: 0;
}
.res-card-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}
.res-card-name a:hover { color: var(--cian-oscuro); }

/* Precio */
.res-card-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 0.25rem;
}
.res-price-old {
    font-size: 0.78rem;
    color: var(--gris-medio);
    text-decoration: line-through;
    font-weight: 500;
}
.res-price-new {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--azul-marino);
}

/* Botón */
.res-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: auto;
}
.res-btn-ver,
.res-btn-add-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--azul-marino);
    border: 1.5px solid var(--azul-marino);
    padding: 0.45rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
}
.res-btn-ver:hover {
    background: var(--azul-marino);
    color: var(--blanco);
}
.res-btn-add-cart {
    background: var(--cian);
    border-color: var(--cian);
    color: var(--azul-marino);
    margin-top: 0;
}
.res-btn-add-cart:hover {
    background: var(--cian-claro);
    border-color: var(--cian-claro);
    color: var(--azul-marino);
}

/* Card oculta por filtro JS */
.res-card[data-hidden="true"] {
    display: none;
}

/* Sin resultados tras filtrar */
.res-no-filter-match {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gris-medio);
    font-size: 0.9rem;
    display: none;
}
.res-no-filter-match.visible {
    display: block;
}

/* =========================================
   BREADCRUMB
   ========================================= */
.res-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--gris-medio);
    margin-bottom: 1.25rem;
}

.res-breadcrumb a {
    color: var(--gris-medio);
    text-decoration: none;
    transition: color 0.2s;
}
.res-breadcrumb a:hover {
    color: var(--cian);
}

.res-breadcrumb-sep {
    font-size: 0.6rem;
    opacity: 0.5;
}

.res-breadcrumb-active {
    color: var(--azul-marino);
    font-weight: 600;
}

/* =========================================
   PAGINACIÓN
   ========================================= */
.res-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.res-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.6rem;
    border-radius: 6px;
    border: 1.5px solid #D0DCE8;
    background: var(--blanco);
    color: var(--gris-oscuro);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.res-page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--cian);
    color: var(--cian);
}
.res-page-btn.active {
    background: var(--azul-marino);
    border-color: var(--azul-marino);
    color: var(--blanco);
    pointer-events: none;
}
.res-page-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

.res-page-ellipsis {
    font-size: 0.9rem;
    color: var(--gris-medio);
    padding: 0 0.2rem;
    line-height: 36px;
}

/* =========================================
   MARCAS — link al catálogo por marca
   ========================================= */
.marca-link {
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.marca-link:hover .marca-img,
.marca-link:focus .marca-img {
    opacity: 0.75;
    transform: scale(1.07);
}
.marca-link:focus-visible {
    outline: 2px solid var(--cian);
    outline-offset: 4px;
    border-radius: 4px;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1200px) {
    .res-layout {
        grid-template-columns: 230px 1fr;
    }
    .res-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .res-layout {
        grid-template-columns: 1fr;
    }
    .res-sidebar {
        position: static;
    }
    .res-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .res-card-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .res-btn-ver,
    .res-btn-add-cart {
        width: 100%;
        flex: none;
    }
}

@media (max-width: 480px) {
    .res-grid { grid-template-columns: 1fr; }
}
