/* ============================================================
   ELAG Filter Pro v4 — CSS Variables + All Filter Types
   All colors/sizes reference CSS custom properties
   set by PHP (ELAG_Settings::css_vars) at runtime.
   ============================================================ */

/* ---- Default variable values (fallback if not set by PHP) ---- */
:root {
    --elag-primary:       #1D1B20;
    --elag-accent:        #4CAF50;
    --elag-text:          #404040;
    --elag-heading:       #080808;
    --elag-border:        #E8E8E8;
    --elag-bg-active:     #F7F7F7;
    --elag-font:          inherit;
    --elag-sidebar-width: 220px;
    --elag-radius:        4px;
    --elag-cb-size:       24px;
}

/* ============================================================
   Sidebar container
   ============================================================ */

.elag-filter-sidebar {
    width: var(--elag-sidebar-width);
    flex-shrink: 0;
    font-family: var(--elag-font);
}

/* ---- Total count header ---- */
.elag-total-count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 20px;
}

.elag-total-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--elag-heading);
    line-height: 1;
    transition: opacity 0.2s;
}

.elag-total-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--elag-heading);
    line-height: 1.43;
}

/* ============================================================
   Shared group label (used by dropdown / radio / tags)
   ============================================================ */

.elag-group-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--elag-heading);
    margin-bottom: 8px;
    line-height: 1.43;
}

/* ============================================================
   Filter group wrapper
   ============================================================ */

.elag-filter-group {
    border-top: 1px solid var(--elag-border);
    padding: 0;
}

.elag-filter-group:last-of-type {
    border-bottom: 1px solid var(--elag-border);
}

/* Top padding for non-accordion types */
.elag-filter-dropdown,
.elag-filter-radio,
.elag-filter-tags {
    padding: 14px 0;
}

/* ============================================================
   TYPE 1 — Accordion + Checkboxes
   ============================================================ */

.elag-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--elag-font);
    text-align: left;
    gap: 8px;
    color: inherit;
}

.elag-accordion-toggle:hover,
.elag-accordion-toggle:active,
.elag-accordion-toggle:focus { background: transparent; outline: none; }

.elag-accordion-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--elag-heading);
    line-height: 1.43;
}

.elag-chevron {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.22s ease;
    color: var(--elag-heading);
}

.elag-accordion-toggle.is-open .elag-chevron {
    transform: rotate(180deg);
}

.elag-accordion-body {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 600px;
    opacity: 1;
}

.elag-accordion-body.is-collapsed {
    max-height: 0;
    opacity: 0;
}

/* Search within filter */
.elag-filter-search-wrap {
    margin-bottom: 8px;
}

.elag-filter-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--elag-border);
    border-radius: var(--elag-radius);
    font-size: 13px;
    color: var(--elag-text);
    background: #fff;
    font-family: var(--elag-font);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.elag-filter-search:focus {
    border-color: var(--elag-primary);
}

/* Checkboxes list */
.elag-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 14px;
}

.elag-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 3px 0;
    user-select: none;
}

.elag-checkbox-label.is-hidden {
    display: none;
}

.elag-checkbox-label:hover .elag-checkmark {
    border-color: var(--elag-primary);
}

.elag-checkbox-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: var(--elag-cb-size);
    height: var(--elag-cb-size);
}

.elag-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.elag-checkmark {
    width: var(--elag-cb-size);
    height: var(--elag-cb-size);
    border: 2.5px solid var(--elag-primary);
    border-radius: var(--elag-radius);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.14s, border-color 0.14s;
}

.elag-checkmark::after {
    content: '';
    display: block;
    width: calc(var(--elag-cb-size) * 0.25);
    height: calc(var(--elag-cb-size) * 0.42);
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(43deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.1s;
}

.elag-checkbox:checked + .elag-checkmark {
    background: var(--elag-primary);
    border-color: var(--elag-primary);
}

.elag-checkbox:checked + .elag-checkmark::after {
    opacity: 1;
}

.elag-checkbox:focus-visible + .elag-checkmark {
    outline: 2px solid var(--elag-accent);
    outline-offset: 2px;
}

/* ── Hierarchical terms ── */
.elag-checkbox-label.elag-depth-0 { padding-left: 0; }
.elag-checkbox-label.elag-depth-1 { padding-left: 20px; }
.elag-checkbox-label.elag-depth-2 { padding-left: 40px; }
.elag-checkbox-label.elag-depth-3 { padding-left: 60px; }

/* Parent term label — slightly bolder */
.elag-checkbox-label.elag-has-children > .elag-term-name {
    font-weight: 600;
}

/* Arrow toggle button next to parent term */
.elag-children-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    padding: 2px 4px;
    background: transparent;
    border: none;
    border-radius: var(--elag-radius);
    cursor: pointer;
    color: var(--elag-text);
    transition: transform 0.2s ease, color 0.15s;
    line-height: 1;
}
.elag-children-toggle:hover { color: var(--elag-primary); }
.elag-children-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}
.elag-children-toggle svg {
    transition: transform 0.2s ease;
    display: block;
}

/* Children container */
.elag-children-wrap {
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 1200px;
    opacity: 1;
}
.elag-children-wrap.is-collapsed {
    max-height: 0;
    opacity: 0;
}

/* Indeterminate state (some but not all children checked) */
.elag-checkbox:indeterminate + .elag-checkmark {
    background: var(--elag-primary);
    border-color: var(--elag-primary);
}
.elag-checkbox:indeterminate + .elag-checkmark::after {
    display: block;
    width: calc(var(--elag-cb-size) * 0.42);
    height: 2.5px;
    border: none;
    background: #fff;
    border-radius: 2px;
    transform: none;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
}

/* Term text */
.elag-term-name {
    font-size: 15px;
    font-weight: 400;
    color: var(--elag-text);
    line-height: 1.43;
    flex: 1;
    transition: color 0.14s;
}

.elag-checkbox:checked ~ .elag-term-name,
.elag-radio:checked ~ .elag-term-name {
    color: var(--elag-heading);
    font-weight: 500;
}

.elag-term-count {
    font-size: 11px;
    color: #ABABAB;
    background: #F4F4F4;
    border-radius: 99px;
    padding: 0 6px;
    line-height: 1.8;
    flex-shrink: 0;
}

/* ============================================================
   TYPE 2 — Dropdown (select)
   ============================================================ */

.elag-select-wrap {
    position: relative;
}

.elag-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 1.5px solid var(--elag-border);
    border-radius: var(--elag-radius);
    background: #fff;
    color: var(--elag-text);
    font-size: 14px;
    font-family: var(--elag-font);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.elag-select:focus,
.elag-select:hover {
    border-color: var(--elag-primary);
}

.elag-select-arrow {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--elag-text);
    display: flex;
}

/* ============================================================
   TYPE 3 — Radio buttons
   ============================================================ */

.elag-radio-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.elag-radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 2px 0;
    user-select: none;
}

.elag-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.elag-radiomark {
    width: var(--elag-cb-size);
    height: var(--elag-cb-size);
    border: 2.5px solid var(--elag-primary);
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.14s;
}

.elag-radiomark::after {
    content: '';
    width: calc(var(--elag-cb-size) * 0.42);
    height: calc(var(--elag-cb-size) * 0.42);
    border-radius: 50%;
    background: var(--elag-primary);
    opacity: 0;
    transition: opacity 0.12s;
}

.elag-radio:checked + .elag-radiomark {
    border-color: var(--elag-primary);
}

.elag-radio:checked + .elag-radiomark::after {
    opacity: 1;
}

.elag-radio:focus-visible + .elag-radiomark {
    outline: 2px solid var(--elag-accent);
    outline-offset: 2px;
}

.elag-radio-item:hover .elag-radiomark {
    border-color: var(--elag-primary);
}

/* ============================================================
   TYPE 4 — Tag / pill buttons
   ============================================================ */

.elag-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.elag-tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1.5px solid var(--elag-border);
    border-radius: 99px;
    background: #fff;
    color: var(--elag-text);
    font-size: 13px;
    font-family: var(--elag-font);
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s, color 0.14s;
    user-select: none;
    line-height: 1.4;
}

.elag-tag-btn:hover {
    border-color: var(--elag-primary);
    color: var(--elag-heading);
}

.elag-tag-btn.is-active {
    border-color: var(--elag-primary);
    background: var(--elag-primary);
    color: #fff;
}

.elag-tag-btn.is-active .elag-tag-count {
    color: rgba(255,255,255,0.7);
}

.elag-tag-count {
    font-size: 11px;
    color: #ABABAB;
    transition: color 0.14s;
}

/* ============================================================
   Reset button
   ============================================================ */

.elag-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 0;
    background: transparent;
    border: none;
    font-family: var(--elag-font);
    font-size: 13px;
    color: #ABABAB;
    cursor: not-allowed;
    transition: color 0.15s;
    pointer-events: none;
}

.elag-reset-btn:not([disabled]) {
    color: var(--elag-heading);
    cursor: pointer;
    pointer-events: auto;
}

.elag-reset-btn:not([disabled]):hover { color: #C0392B; }
.elag-reset-btn:not([disabled]):hover svg { color: #C0392B; }

/* ============================================================
   Grid wrapper + loading state
   ============================================================ */

.elag-grid-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.elag-grid-wrap.is-loading {
    pointer-events: none;
}

/* ============================================================
   Progress bar — shared base
   ============================================================ */

.elag-grid-wrap::before,
.elag-grid-wrap::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.elag-grid-wrap.is-loading::before { opacity: 1; }
.elag-grid-wrap.is-loading::after  { opacity: 1; }

/* ──────────────────────────────────────────────────────────
   1. SWEEP (default) — bar chases itself left→right
   ────────────────────────────────────────────────────────── */
.elag-prog-sweep::before {
    background: linear-gradient(90deg,
        transparent 0%,
        var(--elag-accent) 40%,
        color-mix(in srgb, var(--elag-accent) 55%, white) 70%,
        transparent 100%);
    border-radius: 0 3px 3px 0;
}
.elag-prog-sweep.is-loading::before {
    animation: elag-prog-sweep 1.4s cubic-bezier(0.4,0,0.2,1) infinite;
}
@keyframes elag-prog-sweep {
    0%   { width: 0%;   left: 0%;   }
    50%  { width: 55%;  left: 15%;  }
    100% { width: 0%;   left: 100%; }
}

/* ──────────────────────────────────────────────────────────
   2. FILL — fills to 90%, holds, snaps back
   ────────────────────────────────────────────────────────── */
.elag-prog-fill::before {
    left: 0;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(90deg, var(--elag-accent), color-mix(in srgb, var(--elag-accent) 70%, white));
}
.elag-prog-fill.is-loading::before {
    animation: elag-prog-fill 1.8s ease-in-out infinite;
}
@keyframes elag-prog-fill {
    0%   { width: 0%;   opacity: 1; }
    65%  { width: 88%;  opacity: 1; }
    85%  { width: 95%;  opacity: 1; }
    96%  { width: 100%; opacity: 0; }
    100% { width: 0%;   opacity: 0; }
}

/* ──────────────────────────────────────────────────────────
   3. BOUNCE — ping-pong, fixed-width bar travels L↔R
   ────────────────────────────────────────────────────────── */
.elag-prog-bounce::before {
    background: var(--elag-accent);
    border-radius: 3px;
    width: 35% !important;
}
.elag-prog-bounce.is-loading::before {
    animation: elag-prog-bounce 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
@keyframes elag-prog-bounce {
    0%   { left: 0%;  }
    100% { left: 65%; }
}

/* ──────────────────────────────────────────────────────────
   4. PULSE-FADE — full-width shimmer breathing
   ────────────────────────────────────────────────────────── */
.elag-prog-pulse-fade::before {
    width: 100% !important;
    left: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--elag-accent) 30%,
        color-mix(in srgb, var(--elag-accent) 60%, white) 50%,
        var(--elag-accent) 70%,
        transparent 100%);
    background-size: 200% 100%;
    border-radius: 0;
}
.elag-prog-pulse-fade.is-loading::before {
    animation: elag-prog-pulse-fade 1.6s ease-in-out infinite;
}
@keyframes elag-prog-pulse-fade {
    0%   { background-position: 160% 0; opacity: 0.5; }
    50%  { opacity: 1; }
    100% { background-position: -60% 0; opacity: 0.5; }
}

/* ──────────────────────────────────────────────────────────
   5. GLOW-SWEEP — sweep with a wide glowing halo
   ────────────────────────────────────────────────────────── */
.elag-prog-glow-sweep::before {
    background: linear-gradient(90deg,
        transparent,
        var(--elag-accent) 45%,
        white 55%,
        var(--elag-accent) 65%,
        transparent);
    border-radius: 0 3px 3px 0;
    box-shadow:
        0 0 8px 2px  color-mix(in srgb, var(--elag-accent) 70%, transparent),
        0 0 18px 5px color-mix(in srgb, var(--elag-accent) 35%, transparent);
}
.elag-prog-glow-sweep::after {
    height: 12px;
    top: -5px;
    background: linear-gradient(90deg,
        transparent,
        color-mix(in srgb, var(--elag-accent) 30%, transparent) 50%,
        transparent);
    filter: blur(5px);
}
.elag-prog-glow-sweep.is-loading::before {
    animation: elag-prog-sweep 1.3s cubic-bezier(0.4,0,0.2,1) infinite;
}
.elag-prog-glow-sweep.is-loading::after {
    animation: elag-prog-sweep 1.3s cubic-bezier(0.4,0,0.2,1) infinite;
}

/* ──────────────────────────────────────────────────────────
   6. DOTS — 3 bouncing circles (box-shadow trick)
   ────────────────────────────────────────────────────────── */
.elag-prog-dots::before {
    width:  10px !important;
    height: 10px !important;
    top: 0px;
    left: 50%;
    transform: translateX(-14px); /* shift so 3 dots are centered */
    background: var(--elag-accent);
    border-radius: 50%;
    box-shadow:
        -22px 0 0 var(--elag-accent),
         22px 0 0 var(--elag-accent);
}
.elag-prog-dots.is-loading::before {
    animation: elag-prog-dots 0.85s ease-in-out infinite;
}
@keyframes elag-prog-dots {
    0%, 100% {
        box-shadow: -22px 0px 0 var(--elag-accent),
                      0px 0px 0 color-mix(in srgb, var(--elag-accent) 45%, transparent),
                     22px 0px 0 var(--elag-accent);
    }
    33% {
        box-shadow: -22px -7px 0 var(--elag-accent),
                      0px  0px 0 var(--elag-accent),
                     22px  0px 0 color-mix(in srgb, var(--elag-accent) 45%, transparent);
    }
    66% {
        box-shadow: -22px 0px 0 color-mix(in srgb, var(--elag-accent) 45%, transparent),
                      0px -7px 0 var(--elag-accent),
                     22px 0px 0 var(--elag-accent);
    }
}

/* ──────────────────────────────────────────────────────────
   7. SPLIT — two bars grow from center outward
   ────────────────────────────────────────────────────────── */
.elag-prog-split::before {
    left: 50%;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(to left, var(--elag-accent), color-mix(in srgb, var(--elag-accent) 55%, white));
}
.elag-prog-split::after {
    left: auto;
    right: 50%;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(to right, var(--elag-accent), color-mix(in srgb, var(--elag-accent) 55%, white));
}
.elag-prog-split.is-loading::before {
    animation: elag-prog-split 1.5s ease-in-out infinite;
}
.elag-prog-split.is-loading::after {
    animation: elag-prog-split 1.5s ease-in-out infinite;
}
@keyframes elag-prog-split {
    0%        { width: 0%;  opacity: 1; }
    50%       { width: 50%; opacity: 1; }
    80%       { width: 50%; opacity: 0; }
    100%      { width: 0%;  opacity: 0; }
}

/* ──────────────────────────────────────────────────────────
   8. STRIPE — moving diagonal candy stripes
   ────────────────────────────────────────────────────────── */
.elag-prog-stripe::before {
    width: 100% !important;
    left: 0;
    height: 4px !important;
    background: repeating-linear-gradient(
        -55deg,
        var(--elag-accent)                               0px,
        var(--elag-accent)                               10px,
        color-mix(in srgb, var(--elag-accent) 50%, white) 10px,
        color-mix(in srgb, var(--elag-accent) 50%, white) 20px
    );
    background-size: 30px 100%;
    border-radius: 0;
}
.elag-prog-stripe.is-loading::before {
    animation: elag-prog-stripe 0.55s linear infinite;
}
@keyframes elag-prog-stripe {
    from { background-position: 0 0; }
    to   { background-position: 30px 0; }
}

/* Exit animation */
.elag-grid-leaving .e-loop-item,
.elag-grid-leaving > article {
    animation: elag-card-out 0.18s ease forwards;
}

.elag-grid-leaving > *:nth-child(1) { animation-delay: 0.00s; }
.elag-grid-leaving > *:nth-child(2) { animation-delay: 0.02s; }
.elag-grid-leaving > *:nth-child(3) { animation-delay: 0.03s; }
.elag-grid-leaving > *:nth-child(4) { animation-delay: 0.04s; }
.elag-grid-leaving > *:nth-child(5) { animation-delay: 0.05s; }

@keyframes elag-card-out {
    from { opacity: 1; transform: translateY(0) scale(1);      filter: blur(0px); }
    to   { opacity: 0; transform: translateY(8px) scale(0.97); filter: blur(2px); }
}

/* Shimmer */
.elag-grid-wrap.is-loading .e-loop-item,
.elag-grid-wrap.is-loading > article {
    position: relative;
    overflow: hidden;
}

.elag-grid-wrap.is-loading .e-loop-item::after,
.elag-grid-wrap.is-loading > article::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 20;
    border-radius: inherit;
    background: linear-gradient(
        105deg,
        rgba(255,255,255,0)    0%,
        rgba(255,255,255,0.5)  40%,
        rgba(255,255,255,0.72) 50%,
        rgba(255,255,255,0.5)  60%,
        rgba(255,255,255,0)   100%
    );
    background-size: 250% 100%;
    animation: elag-shimmer 1.2s ease-in-out infinite;
}

@keyframes elag-shimmer {
    0%   { background-position:  160% 0; }
    100% { background-position: -160% 0; }
}

/* Enter animation — BASE class applied by JS */
.elag-grid-animated .e-loop-item,
.elag-grid-animated > article {
    /* animation is set per-class below, delay via inline style */
}

/* ---- 1. fade-up (default) ---- */
.elag-anim-fade-up .e-loop-item,
.elag-anim-fade-up > article {
    animation: elag-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes elag-fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 2. fade-down ---- */
.elag-anim-fade-down .e-loop-item,
.elag-anim-fade-down > article {
    animation: elag-fade-down 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes elag-fade-down {
    from { opacity: 0; transform: translateY(-24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 3. fade-left ---- */
.elag-anim-fade-left .e-loop-item,
.elag-anim-fade-left > article {
    animation: elag-fade-left 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes elag-fade-left {
    from { opacity: 0; transform: translateX(32px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---- 4. fade-right ---- */
.elag-anim-fade-right .e-loop-item,
.elag-anim-fade-right > article {
    animation: elag-fade-right 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes elag-fade-right {
    from { opacity: 0; transform: translateX(-32px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---- 5. zoom-in ---- */
.elag-anim-zoom-in .e-loop-item,
.elag-anim-zoom-in > article {
    animation: elag-zoom-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes elag-zoom-in {
    from { opacity: 0; transform: scale(0.82); filter: blur(3px); }
    to   { opacity: 1; transform: scale(1);    filter: blur(0); }
}

/* ---- 6. zoom-bounce ---- */
.elag-anim-zoom-bounce .e-loop-item,
.elag-anim-zoom-bounce > article {
    animation: elag-zoom-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes elag-zoom-bounce {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---- 7. flip-y ---- */
.elag-anim-flip-y .e-loop-item,
.elag-anim-flip-y > article {
    animation: elag-flip-y 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    backface-visibility: hidden;
}
@keyframes elag-flip-y {
    from { opacity: 0; transform: perspective(600px) rotateX(18deg) translateY(20px); }
    to   { opacity: 1; transform: perspective(600px) rotateX(0deg)  translateY(0); }
}

/* ---- 8. slide-up ---- */
.elag-anim-slide-up .e-loop-item,
.elag-anim-slide-up > article {
    animation: elag-slide-up 0.38s ease both;
    overflow: hidden;
}
@keyframes elag-slide-up {
    from { opacity: 0; transform: translateY(40px) scaleY(0.96); }
    to   { opacity: 1; transform: translateY(0)    scaleY(1); }
}

/* ---- 9. swing ---- */
.elag-anim-swing .e-loop-item,
.elag-anim-swing > article {
    animation: elag-swing 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transform-origin: top center;
}
@keyframes elag-swing {
    from { opacity: 0; transform: rotate(-4deg) translateY(16px); }
    to   { opacity: 1; transform: rotate(0deg)  translateY(0); }
}

/* ============================================================
   Accent animations — applied to active filter controls
   ============================================================ */

/* --- pulse: checked checkbox / active tag pulses once --- */
.elag-accent-pulse .elag-checkbox:checked + .elag-checkmark,
.elag-accent-pulse .elag-tag-btn.is-active {
    animation: elag-accent-pulse 0.35s ease;
}
@keyframes elag-accent-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    70%  { transform: scale(0.94); }
    100% { transform: scale(1); }
}

/* --- ripple: ripple circle on checkbox wrap click --- */
.elag-accent-ripple .elag-checkbox-wrap {
    overflow: visible;
}
.elag-accent-ripple .elag-checkbox:checked + .elag-checkmark::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: var(--elag-primary);
    opacity: 0;
    animation: elag-ripple 0.45s ease-out;
    pointer-events: none;
}
@keyframes elag-ripple {
    0%   { transform: scale(0.5); opacity: 0.35; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* --- glow: checked element glows with accent color --- */
.elag-accent-glow .elag-checkbox:checked + .elag-checkmark,
.elag-accent-glow .elag-tag-btn.is-active,
.elag-accent-glow .elag-radio:checked + .elag-radiomark {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--elag-primary) 30%, transparent);
    animation: elag-glow-pulse 2s ease infinite;
}
@keyframes elag-glow-pulse {
    0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--elag-primary) 30%, transparent); }
    50%       { box-shadow: 0 0 0 6px color-mix(in srgb, var(--elag-primary) 12%, transparent); }
}

/* --- shake: active filter checkbox shakes when another is toggled --- */
.elag-accent-shake .elag-filter-group[data-active="1"] .elag-accordion-label,
.elag-accent-shake .elag-filter-group[data-active="1"] .elag-group-label {
    animation: elag-shake 0.4s ease;
}
@keyframes elag-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-4px); }
    40%      { transform: translateX(4px); }
    60%      { transform: translateX(-3px); }
    80%      { transform: translateX(2px); }
}

/* --- bounce-dot: total count bounces when updated --- */
.elag-accent-bounce-dot .elag-total-number {
    display: inline-block;
}
.elag-total-number.is-updating {
    animation: elag-bounce-dot 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes elag-bounce-dot {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* No results */
.elag-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: #ABABAB;
    font-size: 16px;
    font-family: var(--elag-font);
}

/* ============================================================
   Pagination
   ============================================================ */

.elag-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 36px;
}

.elag-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--elag-border);
    border-radius: var(--elag-radius);
    background: #fff;
    color: var(--elag-text);
    font-size: 14px;
    font-family: var(--elag-font);
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s, color 0.14s;
    line-height: 1;
}

.elag-page-btn:hover:not(.is-active):not(:disabled) {
    border-color: var(--elag-primary);
    color: var(--elag-heading);
}

.elag-page-btn.is-active {
    background: var(--elag-accent);
    border-color: var(--elag-accent);
    color: #fff;
    cursor: default;
    pointer-events: none;
}

.elag-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================================
   Layout helper
   ============================================================ */

/* .elag-filter-layout .elementor-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
} */

/* ============================================================
   v5 — Card stagger via CSS custom property --elag-i
   Set by JS as: element.style.setProperty('--elag-i', index)
   Cleanup timeout is calculated dynamically per card count.
   ============================================================ */

.elag-grid-animated .e-loop-item,
.elag-grid-animated > article {
    animation-delay: calc(var(--elag-i, 0) * 0.065s);
}

/* ============================================================
   v6 — Filter Wrapper (used for both layouts)
   ============================================================ */

.elag-filter-wrapper {
    display: contents; /* transparent wrapper — preserves existing layout */
}

/* ============================================================
   v6 — Horizontal Layout
   Filters are displayed in a row (top-bar style).
   ============================================================ */

.elag-layout-horizontal {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 24px;
    width: 100%;
    contents: initial;
}

.elag-layout-horizontal .elag-filter-sidebar {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 20px;
}

.elag-layout-horizontal .elag-total-count {
    width: 100%;
    margin-bottom: 12px;
}

.elag-layout-horizontal .elag-filter-group {
    flex: 1 1 160px;
    border-top: none;
    border-bottom: none;
    border-left: 1px solid var(--elag-border);
    padding: 0 0 0 20px;
    min-width: 140px;
    max-width: 280px;
    position: relative;
}

/* Horizontal layout: accordion body becomes floating overlay, not in-flow */
.elag-layout-horizontal .elag-accordion-body {
    position: absolute;
    top: 100%;
    left: 0;
    width: var(--elag-dropdown-width, 300px);
    min-width: 200px;
    max-height: var(--elag-dropdown-max-height, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--elag-border) transparent;
    z-index: 200;
    margin-top: 8px;
    padding: 12px 16px;
    border: 1px solid var(--elag-border);
    border-radius: var(--elag-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    background: var(--elag-dropdown-bg, rgba(255,255,255,0.82));
    backdrop-filter: blur(var(--elag-dropdown-blur, 12px)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--elag-dropdown-blur, 12px)) saturate(160%);
}
.elag-layout-horizontal .elag-accordion-body::-webkit-scrollbar { width: 4px; }
.elag-layout-horizontal .elag-accordion-body::-webkit-scrollbar-track { background: transparent; }
.elag-layout-horizontal .elag-accordion-body::-webkit-scrollbar-thumb {
    background: var(--elag-border);
    border-radius: 4px;
}

/* Scroll is now on the body — checkboxes container must NOT clip */
.elag-layout-horizontal .elag-accordion-body .elag-checkboxes {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

/* Children toggle arrow size controlled by CSS var */
.elag-children-toggle svg {
    width: var(--elag-children-arrow-size, 14px);
    height: var(--elag-children-arrow-size, 14px);
}

.elag-layout-horizontal .elag-accordion-body:not(.is-collapsed) {
    transition: opacity 0.2s ease;
}
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Prevent the filter sidebar from collapsing in height when dropdown opens */
.elag-layout-horizontal .elag-filter-sidebar {
    align-items: center;
}

.elag-layout-horizontal .elag-filter-group:first-of-type {
    border-left: none;
    padding-left: 0;
}

.elag-layout-horizontal .elag-reset-btn {
    align-self: center;
    margin-top: 0;
    flex-shrink: 0;
}

/* ============================================================
   v6 — Mobile trigger button
   Controlled by .elag-collapse-{mode} class on the wrapper.
   - mobile  : collapses at <= 768px  (default)
   - tablet  : collapses at <= 1024px
   - always  : collapses on all screen sizes
   ============================================================ */

.elag-mobile-filter-trigger {
    display: none; /* hidden by default, shown via collapse-mode class */
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--elag-primary);
    color: #fff;
    border: none;
    border-radius: var(--elag-radius, 4px);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--elag-font, inherit);
    cursor: pointer;
    transition: opacity 0.2s;
    line-height: 1;
}

.elag-mobile-filter-trigger:hover { opacity: 0.85; }

.elag-mobile-filter-trigger svg { flex-shrink: 0; }

/* --- mobile only (<=768px) --- */
@media (max-width: 768px) {
    .elag-collapse-mobile .elag-mobile-filter-trigger {
        display: inline-flex;
    }
    .elag-collapse-mobile .elag-filter-sidebar {
        display: none !important;
    }
}

/* --- tablet + mobile (<=1024px) --- */
@media (max-width: 1024px) {
    .elag-collapse-tablet .elag-mobile-filter-trigger {
        display: inline-flex;
    }
    .elag-collapse-tablet .elag-filter-sidebar {
        display: none !important;
    }
}

/* --- always (all devices) --- */
.elag-collapse-always .elag-mobile-filter-trigger {
    display: inline-flex;
}
.elag-collapse-always .elag-filter-sidebar {
    display: none !important;
}

/* ============================================================
   v6 — Mobile overlay (backdrop blur)
   ============================================================ */

.elag-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.40);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.elag-mobile-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   v6 — Mobile popup (bottom sheet)
   ============================================================ */

.elag-mobile-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    font-family: var(--elag-font, inherit);
}

.elag-mobile-popup.is-open {
    transform: translateY(0);
}

/* Drag handle indicator */
.elag-mobile-popup::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: #d0d0d0;
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

/* Header bar */
.elag-mobile-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid var(--elag-border, #E8E8E8);
    flex-shrink: 0;
}

.elag-mobile-popup-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    color: var(--elag-heading, #080808);
}

.elag-mobile-popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #e8e8e8;
    border-radius: 50%;
    cursor: pointer;
    color: #1a1a1a !important;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.elag-mobile-popup-close:hover { background: #d4d4d4; }

.elag-mobile-popup-close svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: none;
    pointer-events: none;
}

.elag-mobile-popup-close svg path {
    stroke: #1a1a1a !important;
}

/* Scrollable content area */
.elag-mobile-popup-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 32px;
    flex: 1;
}

/* Inside the popup the sidebar becomes full-width */
.elag-mobile-popup-body .elag-filter-sidebar {
    display: block !important;
    width: 100% !important;
}

/* Prevent body scroll when popup is open */
body.elag-popup-open {
    overflow: hidden;
}

/* ============================================================
   v8 — Auto-animate: .elag-animate на любой Loop Grid
   Карточки скрыты до попадания грида в viewport.
   JS добавляет elag-grid-animated + elag-anim-* и --elag-i.
   ============================================================ */

/* Скрываем карточки только пока грид ждёт попадания в viewport.
   JS добавляет --pending при init и снимает его после анимации. */
.elag-animate--pending .e-loop-item,
.elag-animate--pending > article {
    opacity: 0;
}

/* prefers-reduced-motion — не анимируем совсем */
@media (prefers-reduced-motion: reduce) {
    .elag-animate .e-loop-item,
    .elag-animate > article {
        opacity: 1 !important;
        animation: none !important;
    }
}

/* ── Faceted filtering: dim zero-count terms ── */
.elag-facet-hidden {
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s ease;
}
.elag-facet-hidden .elag-checkbox,
.elag-facet-hidden .elag-radio {
    cursor: default;
}
