/**
 * Paradise Size Filter v3.0
 * Collapsible groups, stock-aware disabled sizes, horizontal bar
 */

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.psf-filter-bar {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px 18px 12px;
    margin-bottom: 20px;
}

/* Header: título + botón limpiar */
.psf-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.psf-bar-title {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ==========================================================================
   COLLAPSIBLE GROUPS
   ========================================================================== */
.psf-filter-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.psf-group {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.psf-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Toggle button */
.psf-group-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
}

.psf-group-toggle:hover .psf-group-label {
    color: #000;
}

.psf-group-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}

.psf-group-label.psf-single {
    display: block;
    margin-bottom: 8px;
}

.psf-group-count {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
}

/* Chevron */
.psf-chevron {
    margin-left: auto;
    width: 18px;
    height: 18px;
    position: relative;
    flex-shrink: 0;
}

.psf-chevron::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
}

.psf-group-toggle[aria-expanded="true"] .psf-chevron::before {
    transform: rotate(-135deg);
    top: 7px;
}

/* Sizes wrap - collapsible */
.psf-sizes-wrap {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.psf-group.psf-collapsed .psf-sizes-wrap {
    max-height: 0;
    opacity: 0;
}

/* ==========================================================================
   SIZE BUTTONS (Pills)
   ========================================================================== */
.psf-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px 0 2px;
}

.psf-size-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 34px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #444;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
}

.psf-size-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #999;
    color: #000;
}

/* Active */
.psf-size-btn.psf-active {
    background: #222;
    color: #fff;
    border-color: #222;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.psf-size-btn.psf-active:hover {
    background: #444;
    border-color: #444;
}

.psf-size-btn:focus-visible {
    outline: 2px solid #222;
    outline-offset: 2px;
}

/* ==========================================================================
   OUT OF STOCK - DISABLED
   ========================================================================== */
.psf-size-btn.psf-no-stock {
    color: #c5c5c5;
    background: #f9f9f9;
    border-color: #eee;
    cursor: not-allowed;
    position: relative;
}

/* Diagonal strike-through line */
.psf-size-btn.psf-no-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    right: 3px;
    height: 1px;
    background: #ccc;
    transform: rotate(-12deg);
    pointer-events: none;
}

.psf-size-btn.psf-no-stock:hover {
    color: #c5c5c5;
    background: #f9f9f9;
    border-color: #eee;
}

/* ==========================================================================
   CLEAR BUTTON
   ========================================================================== */
.psf-clear-btn {
    display: none;
    align-items: center;
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    color: #999;
    background: transparent;
    border: 1px dashed #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
    white-space: nowrap;
    height: 28px;
}

.psf-clear-btn:hover {
    color: #c00;
    border-color: #c00;
    background: #fff5f5;
}

.psf-clear-btn.psf-visible {
    display: inline-flex;
}

.psf-clear-icon {
    margin-right: 4px;
    font-size: 12px;
    line-height: 1;
}

/* ==========================================================================
   ACTIVE FILTERS SUMMARY (persistence indicator)
   ========================================================================== */
.psf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 0 2px;
}

.psf-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: #222;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.psf-active-tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 13px;
    line-height: 1;
    transition: opacity 0.15s;
}

.psf-active-tag-remove:hover {
    opacity: 1;
}

/* ==========================================================================
   PERSISTENCE BADGE
   ========================================================================== */
.psf-persist-badge {
    font-size: 10px;
    color: #999;
    font-style: italic;
    margin-left: 8px;
    font-weight: 400;
}

/* ==========================================================================
   CHECKBOXES STYLE
   ========================================================================== */
[data-style="checkboxes"] .psf-sizes { gap: 4px; }

[data-style="checkboxes"] .psf-size-btn {
    padding: 4px 10px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid transparent;
}

[data-style="checkboxes"] .psf-size-btn::before {
    content: '';
    display: inline-block;
    width: 15px; height: 15px;
    margin-right: 6px;
    border: 1.5px solid #bbb;
    border-radius: 3px;
    background: #fff;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

[data-style="checkboxes"] .psf-size-btn:hover:not(:disabled) { background: #f5f5f5; }
[data-style="checkboxes"] .psf-size-btn:hover:not(:disabled)::before { border-color: #666; }

[data-style="checkboxes"] .psf-size-btn.psf-active {
    background: #f0f0f0; color: #222; border-color: transparent; box-shadow: none;
}

[data-style="checkboxes"] .psf-size-btn.psf-active::before {
    background: #222; border-color: #222;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z' fill='white'/%3E%3C/svg%3E");
    background-size: 13px; background-repeat: no-repeat; background-position: center;
}

[data-style="checkboxes"] .psf-size-btn.psf-no-stock::before { border-color: #ddd; background: #f5f5f5; }
[data-style="checkboxes"] .psf-size-btn.psf-no-stock::after { display: none; }

/* ==========================================================================
   LIST STYLE
   ========================================================================== */
[data-style="list"] .psf-size-btn {
    background: transparent; border: none; padding: 3px 8px; color: #555;
    font-weight: 400; min-width: unset; height: auto;
}
[data-style="list"] .psf-size-btn:hover:not(:disabled) { color: #000; background: #f5f5f5; }
[data-style="list"] .psf-size-btn.psf-active {
    color: #000; font-weight: 700; background: transparent; border: none;
    box-shadow: none; text-decoration: underline; text-underline-offset: 3px;
}
[data-style="list"] .psf-size-btn.psf-no-stock { text-decoration: line-through; }
[data-style="list"] .psf-size-btn.psf-no-stock::after { display: none; }

/* ==========================================================================
   COUNTS
   ========================================================================== */
.psf-count { font-size: 11px; color: #aaa; margin-left: 3px; font-weight: 400; }
.psf-size-btn.psf-active .psf-count { color: rgba(255,255,255,0.65); }
[data-style="checkboxes"] .psf-size-btn.psf-active .psf-count,
[data-style="list"] .psf-size-btn.psf-active .psf-count { color: #999; }

/* ==========================================================================
   RESULTS, LOADING, NO RESULTS
   ========================================================================== */
.psf-results-count {
    font-size: 13px; color: #555; margin: 0 0 12px;
    padding: 8px 14px; background: #f0f8ff;
    border-radius: 6px; border-left: 3px solid #222;
}

.psf-loading-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 10; border-radius: 4px;
}

.psf-spinner {
    width: 36px; height: 36px;
    border: 3px solid #eee; border-top-color: #333;
    border-radius: 50%;
    animation: psf-spin 0.6s linear infinite;
}

@keyframes psf-spin { to { transform: rotate(360deg); } }

.psf-no-results { text-align: center; padding: 40px 20px; color: #888; }
.psf-no-results p { margin: 0; font-size: 15px; }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.psf-pagination { text-align: center; margin-top: 20px; padding: 15px 0; }
.psf-pagination .page-numbers {
    display: inline-block; padding: 6px 12px; margin: 0 2px;
    font-size: 13px; color: #555; text-decoration: none;
    border: 1px solid #ddd; border-radius: 4px; transition: all 0.15s ease;
}
.psf-pagination .page-numbers:hover,
.psf-pagination .page-numbers.current {
    background: #222; color: #fff; border-color: #222;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
    .psf-filter-bar { padding: 12px 14px; }
    .psf-size-btn { min-width: 36px; height: 32px; padding: 4px 8px; font-size: 12px; }
}

@media (max-width: 480px) {
    .psf-sizes { gap: 4px; }
    .psf-size-btn { min-width: 34px; height: 30px; font-size: 11px; }
    .psf-bar-header { flex-wrap: wrap; gap: 6px; }
}

/* ==========================================================================
   TRANSITIONS
   ========================================================================== */
.psf-products-fade { opacity: 0.3; transition: opacity 0.25s ease; }
.psf-products-show { opacity: 1; transition: opacity 0.25s ease; }
