/* ==========================================================================
   DínaCart Filter Panel + Wishlist Panel — dc-filter.css v1.0.0
   ========================================================================== */

[hidden] { display: none !important; }

/* ── Shared backdrop ─────────────────────────────────────────────────────── */
.dc-filter-backdrop,
.dc-wishlist-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99999;   /* below panels but above header */
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.dc-filter-backdrop.open,
.dc-wishlist-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Shared panel base ───────────────────────────────────────────────────── */
.dc-filter-panel,
.dc-wishlist-panel {
    position: fixed;
    top: 0;            /* covers header */
    left: 0;
    bottom: 0;
    width: 320px;
    background: var(--dc-bg);
    border-right: 1px solid var(--dc-border);
    z-index: 100000;   /* above header (z-index: 9999) */
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
    outline: none;
}
.dc-filter-panel.open,
.dc-wishlist-panel.open { transform: translateX(0); }

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER PANEL
═══════════════════════════════════════════════════════════════════════════ */

/* Toolbar filter button */
.dc-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    height: 36px;
    border: 1.5px solid var(--dc-border);
    border-radius: var(--dc-radius-pill);
    background: var(--dc-bg);
    color: var(--dc-text);
    font: 500 13px/1 var(--dc-font);
    cursor: pointer;
    position: relative;
    transition: border-color .15s, background .15s, box-shadow .15s;
    white-space: nowrap;
}
.dc-filter-btn:hover { border-color: var(--dc-text); background: var(--dc-surface); }
.dc-filter-btn.active {
    background: var(--dc-text);
    color: var(--dc-bg);
    border-color: var(--dc-text);
}
.dc-filter-btn__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px; height: 18px;
    padding: 0 4px;
    background: var(--dc-accent);
    color: #fff;
    font-size: 10px; font-weight: 700;
    border-radius: 99px;
    margin-left: 2px;
}

/* Toolbar left group */
.dc-toolbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Panel head */
.dc-filter-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 18px;
    padding-top: max(20px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--dc-border);
    flex-shrink: 0;
    min-height: calc(var(--dc-header-h) + 1px); /* visually aligns with header height */
}
.dc-filter-panel__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dc-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dc-filter-panel__head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dc-filter-clear {
    font-size: 12px;
    font-weight: 500;
    color: var(--dc-accent);
    text-decoration: none;
    white-space: nowrap;
}
.dc-filter-clear:hover { text-decoration: underline; }

.dc-filter-panel__close,
.dc-wishlist-panel__close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--dc-surface);
    color: var(--dc-text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.dc-filter-panel__close:hover,
.dc-wishlist-panel__close:hover { background: var(--dc-surface-hover); color: var(--dc-text); }

/* Panel body */
.dc-filter-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--dc-border) transparent;
}

/* Filter group */
.dc-filter-group {
    border-bottom: 1px solid var(--dc-border);
}
.dc-filter-group__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--dc-text);
    font: 600 13px/1 var(--dc-font);
    cursor: pointer;
    text-align: left;
    transition: background .15s;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.dc-filter-group__toggle:hover { background: var(--dc-surface); }
.dc-filter-group__chevron {
    transition: transform .2s ease;
    flex-shrink: 0;
    color: var(--dc-text-muted);
}
.dc-filter-group__toggle[aria-expanded="false"] .dc-filter-group__chevron {
    transform: rotate(-90deg);
}
.dc-filter-group__body {
    padding: 4px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dc-filter-group__body[hidden] { display: none !important; }

/* Checkbox option */
.dc-filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background .12s;
}
.dc-filter-check:hover { background: var(--dc-surface); padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
.dc-filter-check input[type="checkbox"] { display: none; }
.dc-filter-check__mark {
    width: 18px; height: 18px;
    border: 1.5px solid var(--dc-border);
    border-radius: 5px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    background: var(--dc-bg);
}
.dc-filter-check.checked .dc-filter-check__mark {
    background: var(--dc-text);
    border-color: var(--dc-text);
}
.dc-filter-check.checked .dc-filter-check__mark::after {
    content: '';
    width: 5px; height: 9px;
    border: 2px solid var(--dc-bg);
    border-top: none; border-left: none;
    transform: rotate(42deg) translateY(-1px);
    display: block;
}
.dc-filter-check__label {
    flex: 1;
    font-size: 13px;
    color: var(--dc-text);
    line-height: 1.3;
}
.dc-filter-check__count {
    font-size: 11px;
    color: var(--dc-text-muted);
}

/* Chip options (sizes etc.) */
.dc-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 4px;
}
.dc-filter-chip {
    padding: 6px 14px;
    border: 1.5px solid var(--dc-border);
    border-radius: var(--dc-radius-pill);
    font: 500 12px/1 var(--dc-font);
    color: var(--dc-text);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: .04em;
    transition: all .15s;
    user-select: none;
}
.dc-filter-chip input { display: none; }
.dc-filter-chip:hover { border-color: var(--dc-text); }
.dc-filter-chip.checked { background: var(--dc-text); color: var(--dc-bg); border-color: var(--dc-text); }

/* Color swatches */
.dc-filter-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}
.dc-filter-swatch {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 52px;
}
.dc-filter-swatch input { display: none; }
.dc-filter-swatch__dot {
    display: block;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
    box-shadow: 0 0 0 1px rgba(0,0,0,.15);
    flex-shrink: 0;
}
.dc-filter-swatch:hover .dc-filter-swatch__dot { transform: scale(1.08); }
.dc-filter-swatch.checked .dc-filter-swatch__dot {
    border-color: var(--dc-text);
    box-shadow: 0 0 0 2.5px var(--dc-text);
    transform: scale(1.08);
}
.dc-filter-swatch__name {
    font-size: 10px;
    font-weight: 500;
    color: var(--dc-text-muted);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52px;
}
.dc-filter-swatch.checked .dc-filter-swatch__name { color: var(--dc-text); font-weight: 600; }

/* Text-only swatch (no hex found) — renders like a chip */
.dc-filter-swatch--text {
    max-width: none;
    flex-direction: row;
    gap: 6px;
}
.dc-filter-swatch--text .dc-filter-swatch__name {
    font-size: 12px;
    padding: 5px 12px;
    border: 1.5px solid var(--dc-border);
    border-radius: var(--dc-radius-pill);
    color: var(--dc-text);
    white-space: nowrap;
    max-width: none;
    font-weight: 500;
}
.dc-filter-swatch--text:hover .dc-filter-swatch__name { border-color: var(--dc-text); }
.dc-filter-swatch--text.checked .dc-filter-swatch__name {
    background: var(--dc-text);
    color: var(--dc-bg);
    border-color: var(--dc-text);
}

/* Price range slider */
.dc-price-range { padding-top: 8px; }
.dc-price-range__labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--dc-text);
    margin-bottom: 16px;
}
.dc-price-range__track {
    position: relative;
    height: 4px;
    background: var(--dc-border);
    border-radius: 2px;
    margin: 8px 0 20px;
}
.dc-price-range__fill {
    position: absolute;
    height: 100%;
    background: var(--dc-accent);
    border-radius: 2px;
    pointer-events: none;
}
.dc-price-range__input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    pointer-events: none;
}
.dc-price-range__input::-webkit-slider-thumb { pointer-events: auto; width: 20px; height: 20px; }
.dc-price-range__input::-moz-range-thumb     { pointer-events: auto; width: 20px; height: 20px; }
/* Visible thumbs */
.dc-price-range__thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    background: var(--dc-bg);
    border: 2px solid var(--dc-accent);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    pointer-events: none;
    transition: transform .1s, box-shadow .1s;
}

/* Panel footer */
.dc-filter-panel__footer {
    padding: 14px 20px;
    border-top: 1px solid var(--dc-border);
    flex-shrink: 0;
    background: var(--dc-bg);
}
.dc-filter-apply { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   WISHLIST PANEL
═══════════════════════════════════════════════════════════════════════════ */
.dc-wishlist-panel { width: 360px; }

.dc-wishlist-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 18px;
    padding-top: max(20px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--dc-border);
    flex-shrink: 0;
    min-height: calc(var(--dc-header-h) + 1px);
}
.dc-wishlist-panel__title {
    font-size: 15px; font-weight: 600;
    color: var(--dc-text); margin: 0;
    display: flex; align-items: center; gap: 8px;
}
.dc-wishlist-panel__count {
    font-size: 12px; font-weight: 400;
    color: var(--dc-text-muted);
}

/* Skeleton */
.dc-wishlist-panel__skeleton { padding: 12px 16px; }
.dc-wishlist-skel-item {
    display: flex; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--dc-border);
}
.dc-wishlist-skel-img {
    width: 72px; height: 80px;
    border-radius: 10px; flex-shrink: 0;
}
.dc-wishlist-skel-text { flex: 1; padding-top: 4px; }

/* Items list */
.dc-wishlist-panel__items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--dc-border) transparent;
}
.dc-wishlist-item {
    display: flex;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--dc-border);
    align-items: flex-start;
    transition: background .15s;
}
.dc-wishlist-item:hover { background: var(--dc-surface); }
.dc-wishlist-item__img {
    width: 72px; height: 80px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--dc-surface);
}
.dc-wishlist-item__info { flex: 1; min-width: 0; }
.dc-wishlist-item__cat {
    font-size: 10px; font-weight: 600;
    color: var(--dc-text-muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin: 0 0 3px;
}
.dc-wishlist-item__name {
    font-size: 13px; font-weight: 500;
    color: var(--dc-text); line-height: 1.35;
    margin: 0 0 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dc-wishlist-item__price {
    font-size: 13px; font-weight: 600; color: var(--dc-text);
    margin: 0 0 10px;
}
.dc-wishlist-item__price del { color: var(--dc-text-muted); font-weight: 400; font-size: 11px; margin-right: 3px; }
.dc-wishlist-item__price ins { text-decoration: none; color: var(--dc-accent); }
.dc-wishlist-item__actions { display: flex; gap: 6px; align-items: center; }
.dc-wishlist-item__atc {
    padding: 5px 20px; height: 20px;
    font-size: 11px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
}
.dc-wishlist-item__remove {
    width: 28px; height: 28px;
    border-radius: 50%; border: none;
    background: var(--dc-surface);
    color: var(--dc-text-muted);
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.dc-wishlist-item__remove:hover { background: #fef2f2; color: #dc2626; }

/* Empty state */
.dc-wishlist-panel__empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; flex: 1;
    padding: 48px 24px;
    text-align: center;
    color: var(--dc-text-muted);
}
.dc-wishlist-panel__empty svg { opacity: .3; }
.dc-wishlist-panel__empty p { font-size: 14px; margin: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — Filter full screen, wishlist from bottom
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Filter — full screen overlay */
    .dc-filter-panel {
        width: 100%;
        top: 0;
        transform: translateX(-100%);
    }

    /* Wishlist — slide up from bottom */
    .dc-wishlist-panel {
        width: 100%;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        height: 85dvh;
        border-right: none;
        border-top: 1px solid var(--dc-border);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    .dc-wishlist-panel.open { transform: translateY(0); }

    /* Hide result count on very small screens — save space */
    .dc-toolbar__count { display: none; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .dc-filter-panel, .dc-filter-backdrop,
    .dc-wishlist-panel, .dc-wishlist-backdrop { transition: none !important; }
}
