/* ═══════════════════════════════════════════════════════
   IDC Catalog Filters — Gradient Vivid Light (Polished)
   Version: 2.0.0
   ═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
    --idc-cf-bg: #ffffff;
    --idc-cf-text: #1a1a2e;
    --idc-cf-text-dim: #64748b;
    --idc-cf-accent: #001d81;
    --idc-cf-accent2: #6c5ce7;
    --idc-cf-gradient: linear-gradient(135deg, #001d81, #6c5ce7);
    --idc-cf-gradient-light: linear-gradient(135deg, rgba(0, 29, 129, 0.04), rgba(108, 92, 231, 0.04));
    --idc-cf-chip-bg: #ffffff;
    --idc-cf-chip-hover: #f8f9ff;
    --idc-cf-chip-active-bg: linear-gradient(135deg, #001d81, #6c5ce7);
    --idc-cf-dropdown-bg: #f5f6fa;
    --idc-cf-radius: 16px;
    --idc-cf-radius-sm: 10px;
    --idc-cf-radius-pill: 50px;
    --idc-cf-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --idc-cf-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Main Container ── */
.idc-cf {
    font-family: var(--idc-cf-font);
    background: var(--idc-cf-bg);
    border: none;
    border-radius: var(--idc-cf-radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 10;
    overflow: visible;
}

/* Subtle gradient accent line top */
.idc-cf::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 3px;
    background: var(--idc-cf-gradient);
    border-radius: 0 0 3px 3px;
    opacity: 0.7;
}

/* ── Active Filters Bar ── */
.idc-cf__active {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: none;
    flex-wrap: wrap;
}

.idc-cf__active-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.idc-cf__active-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: var(--idc-cf-gradient);
    border: none;
    border-radius: var(--idc-cf-radius-pill);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all var(--idc-cf-transition);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.25);
}

.idc-cf__active-tag:hover {
    opacity: 0.85;
    transform: scale(0.97);
}

.idc-cf__active-tag svg {
    opacity: 0.7;
}

.idc-cf__active-tag:hover svg {
    opacity: 1;
}

.idc-cf__clear-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    background: #fef2f2;
    border: none;
    border-radius: var(--idc-cf-radius-pill);
    color: #ef4444;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--idc-cf-transition);
    white-space: nowrap;
    font-family: var(--idc-cf-font);
}

.idc-cf__clear-all:hover {
    background: #fee2e2;
}

/* ── Group Headers ── */
.idc-cf__group {
    margin-bottom: 16px;
}

.idc-cf__group:last-of-type {
    margin-bottom: 14px;
}

.idc-cf__group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.idc-cf__group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--idc-cf-text-dim);
}

.idc-cf__group-count {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: var(--idc-cf-gradient);
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════
   VISUAL CHIPS — Brands & Processors
   Card-style chips with white bg, shadow, clear logos
   ═══════════════════════════════════════════════════════ */

.idc-cf__chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 92, 231, 0.15) transparent;
    -webkit-overflow-scrolling: touch;
}

.idc-cf__chips::-webkit-scrollbar {
    height: 3px;
}

.idc-cf__chips::-webkit-scrollbar-track {
    background: transparent;
}

.idc-cf__chips::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.15);
    border-radius: 4px;
}

/* ── Chip: Default (white card) ── */
.idc-cf__chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px 6px;
    background: #fff;
    border: none;
    border-radius: var(--idc-cf-radius-sm);
    color: var(--idc-cf-text);
    cursor: pointer;
    transition: all var(--idc-cf-transition);
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: start;
    font-family: var(--idc-cf-font);
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    min-width: 70px;
}

/* ── Chip: Hover ── */
.idc-cf__chip:hover {
    box-shadow: 0 4px 16px rgba(0, 29, 129, 0.12), 0 0 0 1px rgba(0, 29, 129, 0.08);
    transform: translateY(-2px);
    background: #f8f9ff;
}

/* ── Chip: Selected (gradient bg) ── */
.idc-cf__chip[aria-selected="true"] {
    background: var(--idc-cf-chip-active-bg);
    color: #fff;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.35);
    transform: translateY(-2px);
}

.idc-cf__chip[aria-selected="true"] .idc-cf__chip-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.idc-cf__chip[aria-selected="true"] .idc-cf__chip-svg {
    fill: #fff;
    opacity: 1;
}

.idc-cf__chip[aria-selected="true"] .idc-cf__chip-initial {
    color: #fff;
}

/* ── Chip Logo Area ── */
.idc-cf__chip-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 32px;
    flex-shrink: 0;
}

/* ── Brand Logo (IMG from WooCommerce) ── */
.idc-cf__chip-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: all var(--idc-cf-transition);
}

.idc-cf__chip[aria-selected="true"] .idc-cf__chip-img {
    filter: brightness(0) invert(1);
}

/* ── CPU Emoji ── */
.idc-cf__chip-emoji {
    font-size: 1.2rem;
    line-height: 1;
}

/* ── Chip Text Fallback ── */
.idc-cf__chip-initial {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--idc-cf-text);
    transition: color var(--idc-cf-transition);
}

.idc-cf__chip:hover .idc-cf__chip-initial {
    color: var(--idc-cf-accent);
}

/* ── Chip Name (visible text under logo) ── */
.idc-cf__chip-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--idc-cf-text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--idc-cf-transition);
}

.idc-cf__chip[aria-selected="true"] .idc-cf__chip-name {
    color: #fff;
}

/* ── Chip Count Badge ── */
.idc-cf__chip-count {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 8px;
    background: rgba(0, 29, 129, 0.06);
    color: var(--idc-cf-accent);
    transition: all var(--idc-cf-transition);
    min-width: 18px;
    text-align: center;
    line-height: 1.5;
}

.idc-cf__chip:hover .idc-cf__chip-count {
    background: rgba(108, 92, 231, 0.1);
    color: var(--idc-cf-accent2);
}

/* ═══════════════════════════════════════════════════════
   DROPDOWN FILTERS — Subtle pill-style triggers
   ═══════════════════════════════════════════════════════ */

.idc-cf__dropdowns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.idc-cf__dropdown {
    position: relative;
    flex: 0 1 auto;
    min-width: 100px;
}

/* ── Trigger: Default (subtle pill) ── */
.idc-cf__dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 7px 12px;
    background: var(--idc-cf-dropdown-bg);
    border: none;
    border-radius: var(--idc-cf-radius-pill);
    color: var(--idc-cf-text);
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--idc-cf-transition);
    font-family: var(--idc-cf-font);
    white-space: nowrap;
}

/* ── Trigger: Hover ── */
.idc-cf__dropdown-trigger:hover {
    background: #eaecf5;
}

/* ── Trigger: Open ── */
.idc-cf__dropdown-trigger[aria-expanded="true"] {
    background: #e0e3f0;
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15);
}

/* ── Trigger: Has Active Selection (gradient pill) ── */
.idc-cf__dropdown--has-active .idc-cf__dropdown-trigger {
    background: var(--idc-cf-gradient);
    color: #fff;
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.25);
}

.idc-cf__dropdown-icon {
    font-size: 0.82rem;
    line-height: 1;
}

.idc-cf__dropdown-label {
    flex: 1;
    text-align: left;
}

.idc-cf__dropdown-arrow {
    opacity: 0.4;
    transition: transform var(--idc-cf-transition), opacity var(--idc-cf-transition);
}

.idc-cf__dropdown-trigger[aria-expanded="true"] .idc-cf__dropdown-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}

.idc-cf__dropdown--has-active .idc-cf__dropdown-arrow {
    opacity: 0.8;
    stroke: #fff;
}

/* ── Dropdown Menu ── */
.idc-cf__dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: none;
    border-radius: var(--idc-cf-radius-sm);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    z-index: 100;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 92, 231, 0.12) transparent;
}

.idc-cf__dropdown-menu::-webkit-scrollbar {
    width: 4px;
}

.idc-cf__dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.12);
    border-radius: 4px;
}

.idc-cf__dropdown-menu.idc-cf__dropdown-menu--open {
    display: block;
    animation: idc-cf-dropdown-in 0.18s ease-out;
}

@keyframes idc-cf-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Dropdown Items ── */
.idc-cf__dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--idc-cf-text);
    font-size: 0.76rem;
    font-family: var(--idc-cf-font);
    cursor: pointer;
    transition: all var(--idc-cf-transition);
    text-align: left;
}

.idc-cf__dropdown-item:hover {
    background: var(--idc-cf-gradient-light);
}

.idc-cf__dropdown-item[aria-selected="true"] {
    background: var(--idc-cf-gradient-light);
}

.idc-cf__dropdown-item-check {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--idc-cf-transition);
}

.idc-cf__dropdown-item-check svg {
    opacity: 0;
    transition: opacity var(--idc-cf-transition);
}

.idc-cf__dropdown-item[aria-selected="true"] .idc-cf__dropdown-item-check {
    background: var(--idc-cf-gradient);
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(108, 92, 231, 0.3);
}

.idc-cf__dropdown-item[aria-selected="true"] .idc-cf__dropdown-item-check svg {
    opacity: 1;
    stroke: #fff;
}

.idc-cf__dropdown-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.idc-cf__dropdown-item-count {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(0, 29, 129, 0.05);
    color: var(--idc-cf-accent);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   SORT
   ═══════════════════════════════════════════════════════ */

.idc-cf__sort {
    display: flex;
    justify-content: flex-end;
}

.idc-cf__sort-select {
    padding: 7px 30px 7px 12px;
    background: var(--idc-cf-dropdown-bg);
    border: none;
    border-radius: var(--idc-cf-radius-pill);
    color: var(--idc-cf-text);
    font-size: 0.74rem;
    font-weight: 500;
    font-family: var(--idc-cf-font);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c5ce7' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all var(--idc-cf-transition);
}

.idc-cf__sort-select:hover,
.idc-cf__sort-select:focus {
    outline: none;
    background-color: #eaecf5;
}

/* ═══════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════ */

.idc-cf__loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9999;
    color: var(--idc-cf-text);
    font-family: var(--idc-cf-font);
    font-size: 0.85rem;
    font-weight: 500;
}

.idc-cf__loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(108, 92, 231, 0.12);
    border-top-color: var(--idc-cf-accent2);
    border-radius: 50%;
    animation: idc-cf-spin 0.7s linear infinite;
}

@keyframes idc-cf-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .idc-cf {
        padding: 14px 14px;
        border-radius: 12px;
        margin: 0 0 16px;
    }

    .idc-cf::before {
        left: 14px;
        right: 14px;
    }

    .idc-cf__chips {
        gap: 6px;
        padding-bottom: 6px;
    }

    .idc-cf__chip {
        padding: 8px 10px 5px;
        min-width: 58px;
    }

    .idc-cf__chip-logo {
        width: 48px;
        height: 24px;
    }

    .idc-cf__chip-count {
        font-size: 0.56rem;
        padding: 1px 5px;
    }

    .idc-cf__dropdowns {
        gap: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .idc-cf__dropdown {
        min-width: 95px;
        flex-shrink: 0;
    }

    .idc-cf__dropdown-trigger {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .idc-cf__dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        max-height: 50vh;
        border-radius: 18px 18px 0 0;
        border: none;
        border-top: 3px solid var(--idc-cf-accent2);
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
        padding: 12px 12px 28px;
        z-index: 10001;
    }

    .idc-cf__dropdown-menu.idc-cf__dropdown-menu--open {
        animation: idc-cf-slide-up 0.25s ease-out;
    }

    @keyframes idc-cf-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .idc-cf__dropdown-item {
        padding: 11px 12px;
        font-size: 0.84rem;
    }

    .idc-cf__sort-select {
        width: 100%;
        font-size: 0.72rem;
    }

    .idc-cf__group-label {
        font-size: 0.64rem;
    }
}

/* ── Mobile Backdrop ── */
.idc-cf__mobile-backdrop {
    display: none;
}

@media (max-width: 767px) {
    .idc-cf__mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 10000;
        animation: idc-cf-fade-in 0.2s;
    }

    @keyframes idc-cf-fade-in {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}
