/* =============================================================================
   DynFilters – layout horizontal (displayHeaderCategory)
   Compatible con tema vt_interior_elements / PrestaShop 8.2
   ============================================================================= */

/* --------------------------------------------------------------------------
   Contenedor principal – barra horizontal
   -------------------------------------------------------------------------- */
.dynfilters-widget {
    width: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    font-family: inherit;
    font-size: 14px;
    color: #333;
}

/* --------------------------------------------------------------------------
   Cabecera
   -------------------------------------------------------------------------- */
.dynfilters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 6px 6px 0 0;
}

.dynfilters-title {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.dynfilters-reset {
    background: none;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all .15s;
}
.dynfilters-reset:hover { border-color: #333; color: #333; }

/* --------------------------------------------------------------------------
   Formulario – fila horizontal de grupos
   -------------------------------------------------------------------------- */
#dynfilters-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0;
    padding: 0;
}

/* --------------------------------------------------------------------------
   Cada grupo de filtro – columna dentro de la barra
   -------------------------------------------------------------------------- */
.dynfilters-group {
    position: relative;
    border-right: 1px solid #e0e0e0;
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 260px;
}

.dynfilters-group:last-of-type {
    border-right: none;
}

/* Botón toggle (cabecera del grupo) */
.dynfilters-group__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    gap: 6px;
}

.dynfilters-group__label {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dynfilters-group__chevron {
    font-size: 10px;
    color: #888;
    transition: transform .2s;
    flex-shrink: 0;
}

.dynfilters-group.is-collapsed .dynfilters-group__chevron {
    transform: rotate(-90deg);
}

/* Body desplegable – panel flotante */
.dynfilters-group__body {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    padding: 10px 14px;
    z-index: 100;
}

.dynfilters-group.is-collapsed .dynfilters-group__body {
    display: none;
}

/* --------------------------------------------------------------------------
   Listas de valores
   -------------------------------------------------------------------------- */
.dynfilters-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.dynfilters-list__item + .dynfilters-list__item {
    margin-top: 5px;
}

/* Checkbox */
.dynfilters-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.dynfilters-check__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dynfilters-check__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 2px solid #bbb;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all .15s;
}

.dynfilters-check__input:checked ~ .dynfilters-check__box {
    background: #333;
    border-color: #333;
}

.dynfilters-check__input:checked ~ .dynfilters-check__box::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

/* Radio */
.dynfilters-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.dynfilters-radio__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dynfilters-radio__dot {
    width: 16px;
    height: 16px;
    border: 2px solid #bbb;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: border-color .15s;
}

.dynfilters-radio__input:checked ~ .dynfilters-radio__dot {
    border-color: #333;
}

.dynfilters-radio__input:checked ~ .dynfilters-radio__dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 8px; height: 8px;
    background: #333;
    border-radius: 50%;
}

/* Swatch de color */
.dynfilters-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,.15);
    flex-shrink: 0;
}

/* Select */
.dynfilters-select {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 13px;
    min-height: 80px;
}

/* --------------------------------------------------------------------------
   Range slider
   -------------------------------------------------------------------------- */
.dynfilters-range { padding: 4px 0 8px; min-width: 180px; }

.dynfilters-range__track {
    position: relative;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 12px 0 6px;
}

.dynfilters-range__fill {
    position: absolute;
    height: 100%;
    background: #333;
    border-radius: 2px;
}

.dynfilters-range__thumb {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

.dynfilters-range__thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #333;
    pointer-events: all;
    cursor: pointer;
}

.dynfilters-range__thumb::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #333;
    pointer-events: all;
    cursor: pointer;
}

.dynfilters-range__labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Botón Aplicar – al final de la barra
   -------------------------------------------------------------------------- */
.dynfilters-apply-wrap {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    flex-shrink: 0;
}

.dynfilters-apply {
    white-space: nowrap;
    padding: 8px 18px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.dynfilters-apply:hover { background: #555; }

/* --------------------------------------------------------------------------
   Overlay de carga
   -------------------------------------------------------------------------- */
.dynfilters-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.dynfilters-overlay.is-active { display: flex; }

.dynfilters-spinner {
    width: 44px; height: 44px;
    animation: dynf-spin 1s linear infinite;
}

.dynfilters-spinner circle {
    stroke: #333;
    stroke-linecap: round;
    stroke-dasharray: 94;
    stroke-dashoffset: 60;
    animation: dynf-dash 1.4s ease-in-out infinite;
}

@keyframes dynf-spin  { to { transform: rotate(360deg); } }
@keyframes dynf-dash  {
    0%   { stroke-dashoffset: 80; }
    50%  { stroke-dashoffset: 20; }
    100% { stroke-dashoffset: 80; }
}

/* --------------------------------------------------------------------------
   Responsive – en móvil vuelve a layout vertical
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    #dynfilters-form {
        flex-direction: column;
    }

    .dynfilters-group {
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .dynfilters-group__body {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 6px 14px 12px;
    }

    .dynfilters-apply-wrap {
        padding: 10px 14px 14px;
    }

    .dynfilters-apply { width: 100%; }
}
