/* ═══════════════════════════════════════════════════════════════
   WC AJAX FILTERS v2 — No-AJAX Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
    --wcaf-primary: #2563eb;
    --wcaf-primary-hover: #1d4ed8;
    --wcaf-text: #1e293b;
    --wcaf-text-light: #64748b;
    --wcaf-border: #e2e8f0;
    --wcaf-bg: #ffffff;
    --wcaf-bg-hover: #f8fafc;
    --wcaf-radius: 6px;
    --wcaf-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --wcaf-transition: 0.2s ease;
}

/* ─── WRAPPER ───────────────────────────────────────────────── */
.wcaf-filters-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--wcaf-text);
    line-height: 1.5;
}

.wcaf-vertical { max-width: 280px; }

.wcaf-horizontal {
    display: flex; flex-wrap: wrap; gap: 16px;
    align-items: flex-start; max-width: 100%;
}
.wcaf-horizontal .wcaf-filter-group { flex: 1 1 200px; min-width: 180px; }

/* ─── FILTER GROUP ──────────────────────────────────────────── */
.wcaf-filter-group {
    background: var(--wcaf-bg);
    border: 1px solid var(--wcaf-border);
    border-radius: var(--wcaf-radius);
    margin-bottom: 12px;
    box-shadow: var(--wcaf-shadow);
    overflow: hidden;
}

.wcaf-filter-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; cursor: pointer; user-select: none;
    transition: background var(--wcaf-transition);
}
.wcaf-filter-header:hover { background: var(--wcaf-bg-hover); }

.wcaf-filter-title {
    margin: 0; padding: 0; font-size: 13px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--wcaf-text);
}

.wcaf-toggle-icon { font-size: 18px; font-weight: 300; color: var(--wcaf-text-light); line-height: 1; }

.wcaf-filter-body {
    padding: 8px 16px 16px;
    border-top: 1px solid var(--wcaf-border);
}

/* ─── LINK LIST (Categories) ───────────────────────────────── */
.wcaf-link-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--wcaf-border) transparent; }
.wcaf-link-list::-webkit-scrollbar { width: 5px; }
.wcaf-link-list::-webkit-scrollbar-thumb { background: var(--wcaf-border); border-radius: 3px; }

.wcaf-link-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 8px;
    border-radius: 4px; cursor: pointer; text-decoration: none; color: var(--wcaf-text);
    transition: background var(--wcaf-transition), color var(--wcaf-transition);
}
.wcaf-link-item:hover { background: var(--wcaf-bg-hover); color: var(--wcaf-primary); }

.wcaf-link-item::before {
    content: ''; display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; min-width: 18px;
    border: 2px solid var(--wcaf-border); border-radius: 4px; background: var(--wcaf-bg);
    transition: all var(--wcaf-transition); font-size: 12px; line-height: 1;
}
.wcaf-link-item:hover::before { border-color: var(--wcaf-primary); background: var(--wcaf-primary); content: '→'; color: #fff; }

.wcaf-link-name { font-size: 13px; }

/* ─── CHECKBOX LIST (Attributes/Brands) ────────────────────── */
.wcaf-checkbox-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--wcaf-border) transparent; }
.wcaf-checkbox-list::-webkit-scrollbar { width: 5px; }
.wcaf-checkbox-list::-webkit-scrollbar-thumb { background: var(--wcaf-border); border-radius: 3px; }

.wcaf-checkbox-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 8px;
    border-radius: 4px; cursor: pointer; margin: 0; text-decoration: none; color: var(--wcaf-text);
    transition: background var(--wcaf-transition);
}
.wcaf-checkbox-item:hover { background: var(--wcaf-bg-hover); }

.wcaf-checkmark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; min-width: 18px;
    border: 2px solid var(--wcaf-border); border-radius: 4px;
    transition: all var(--wcaf-transition); background: var(--wcaf-bg);
}

/* Active state for checkbox items */
.wcaf-checkbox-item.wcaf-item-active .wcaf-checkmark {
    background: var(--wcaf-primary); border-color: var(--wcaf-primary);
}
.wcaf-checkbox-item.wcaf-item-active .wcaf-checkmark::after {
    content: ''; display: block; width: 5px; height: 9px;
    border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-top: -2px;
}

.wcaf-item-name { font-size: 13px; color: var(--wcaf-text); }

.wcaf-hidden-item { display: none; }

.wcaf-show-more {
    display: inline-block; margin-top: 8px; padding: 0; background: none;
    border: none; color: var(--wcaf-primary); font-size: 12px;
    cursor: pointer; text-decoration: underline;
}
.wcaf-show-more:hover { color: var(--wcaf-primary-hover); }

/* ─── COLOR SWATCHES ────────────────────────────────────────── */
.wcaf-color-list {
    display: flex; flex-wrap: wrap; gap: 8px;
    max-height: 280px; overflow-y: auto; scrollbar-width: thin;
}

.wcaf-color-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer; padding: 6px; border-radius: var(--wcaf-radius);
    transition: all var(--wcaf-transition); min-width: 48px; text-decoration: none;
}
.wcaf-color-item:hover { background: var(--wcaf-bg-hover); }

.wcaf-color-swatch {
    display: block; width: 32px; height: 32px; border-radius: 50%;
    transition: all var(--wcaf-transition); box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wcaf-color-item.wcaf-color-active .wcaf-color-swatch {
    box-shadow: 0 0 0 3px var(--wcaf-primary) !important; transform: scale(1.1);
}

.wcaf-color-name {
    font-size: 10px; color: var(--wcaf-text-light); text-align: center;
    max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── ACTIVE FILTERS ────────────────────────────────────────── */
.wcaf-active-filters {
    margin-bottom: 16px; padding: 12px 16px;
    background: #f0f4ff; border: 1px solid #c7d6fe; border-radius: var(--wcaf-radius);
}

.wcaf-active-filters-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

.wcaf-active-label {
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--wcaf-primary);
}

.wcaf-reset-all {
    background: none; border: none; color: var(--wcaf-primary);
    font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0;
}
.wcaf-reset-all:hover { color: var(--wcaf-primary-hover); }

.wcaf-active-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.wcaf-active-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: var(--wcaf-bg); border: 1px solid var(--wcaf-border);
    border-radius: 20px; font-size: 12px; color: var(--wcaf-text);
    text-decoration: none; transition: all var(--wcaf-transition);
}
.wcaf-active-tag:hover { border-color: #dc2626; color: #dc2626; }

.wcaf-tag-remove { font-size: 14px; line-height: 1; color: var(--wcaf-text-light); }
.wcaf-active-tag:hover .wcaf-tag-remove { color: #dc2626; }

/* ─── RESULTS ───────────────────────────────────────────────── */
.wcaf-no-results { text-align: center; padding: 40px 20px; color: var(--wcaf-text-light); }
.wcaf-no-results p { margin-bottom: 16px; font-size: 15px; }

/* ─── ERROR ─────────────────────────────────────────────────── */
.wcaf-error { color: #dc2626; font-size: 13px; }

/* ─── MOBILE TOOLBAR (hidden on desktop) ───────────────────── */
.wcaf-mobile-toolbar { display: none; }
.wcaf-mobile-drawer-header { display: none; }
.wcaf-mobile-panel { display: none; }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .wcaf-vertical { max-width: 100%; }
    .wcaf-horizontal { flex-direction: column; }
    .wcaf-horizontal .wcaf-filter-group { flex-basis: 100%; }
    .wcaf-color-swatch { width: 28px; height: 28px; }

    .wcaf-mobile-toolbar {
        display: flex; gap: 10px; margin-top: 20px; margin-bottom: 24px;
    }

    .wcaf-mobile-btn {
        flex: 1; display: flex; align-items: center; justify-content: center;
        gap: 8px; padding: 12px 16px; border: 1px solid var(--wcaf-border);
        border-radius: var(--wcaf-radius); background: var(--wcaf-bg);
        color: var(--wcaf-text); font-size: 14px; font-weight: 600;
        cursor: pointer; transition: all var(--wcaf-transition);
        box-shadow: var(--wcaf-shadow); text-decoration: none;
    }
    .wcaf-mobile-btn:active { transform: scale(0.97); }

    .wcaf-mobile-btn-filter { background: var(--wcaf-primary); color: #fff; border-color: var(--wcaf-primary); }
    .wcaf-mobile-btn-filter:hover { background: var(--wcaf-primary-hover); }

    .wcaf-mobile-btn-reset { background: var(--wcaf-bg); color: var(--wcaf-text-light); border-color: var(--wcaf-border); }
    .wcaf-mobile-btn-reset:hover { color: #dc2626; border-color: #dc2626; }

    .wcaf-mobile-btn-icon { font-size: 16px; line-height: 1; }

    .wcaf-mobile-badge {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
        background: rgba(255,255,255,0.25); font-size: 11px; font-weight: 700; line-height: 1;
    }

    /* Hide filters by default on mobile */
    .wcaf-filters-inner,
    .wcaf-active-filters { display: none; }

    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-filters-inner { display: block; animation: wcaf-slide-up 0.3s ease; }
    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-active-filters { display: block; }

    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-mobile-panel {
        display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        z-index: 9998; background: rgba(0,0,0,0.45); animation: wcaf-fade-in 0.2s ease;
    }

    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-filters-inner {
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
        background: var(--wcaf-bg); max-height: 70vh; overflow-y: auto;
        padding: 0 16px 32px; border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.15); -webkit-overflow-scrolling: touch;
    }

    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-filter-body .wcaf-checkbox-list,
    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-filter-body .wcaf-link-list,
    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-filter-body .wcaf-color-list { max-height: 200px; }

    .wcaf-filters-wrapper.wcaf-mobile-open .wcaf-mobile-drawer-header {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; background: var(--wcaf-bg);
        padding: 12px 0 8px; z-index: 1;
        border-bottom: 1px solid var(--wcaf-border); margin-bottom: 12px;
    }

    .wcaf-drawer-handle {
        width: 40px; height: 4px; background: var(--wcaf-border); border-radius: 2px;
        position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    }

    .wcaf-drawer-title { font-size: 15px; font-weight: 700; color: var(--wcaf-text); margin: 0; padding-top: 4px; }

    .wcaf-drawer-close {
        background: var(--wcaf-primary); border: none; font-size: 18px; color: #fff;
        cursor: pointer; padding: 8px 16px; line-height: 1; border-radius: var(--wcaf-radius);
        font-weight: 600; box-shadow: var(--wcaf-shadow); transition: all var(--wcaf-transition);
    }
    .wcaf-drawer-close:hover, .wcaf-drawer-close:active { background: var(--wcaf-primary-hover); transform: scale(1.05); }

    @keyframes wcaf-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
    @keyframes wcaf-fade-in { from { opacity: 0; } to { opacity: 1; } }
}
