/* ══════════════════════════════════════════════════════════
   TIBS Filter Addon — filter-style.css  v2.8.0
   Single-row horizontal bar · Never wraps · Mobile-first
   Compact: Search = icon→expand | Price = popover | Reset = icon
══════════════════════════════════════════════════════════ */

:root {
    --tibsf-purple:    #6366f1;
    --tibsf-purple-dk: #4f46e5;
    --tibsf-text:      #111827;
    --tibsf-muted:     #6b7280;
    --tibsf-border:    #e5e7eb;
    --tibsf-white:     #ffffff;
    --tibsf-surface:   #f8fafc;
    --tibsf-trans:     .18s ease;
    --tibsf-radius:    8px;
    --tibsf-bar-h:     44px;
}

/* ─── WRAPPER ─── */
.tibsf-wrap { width: 100%; margin-bottom: 20px; position: relative; }

/* ─── BAR ─── */
.tibsf-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;       /* NEVER WRAP */
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: var(--tibsf-bar-h);
    background: var(--tibsf-white);
    border: 1.5px solid var(--tibsf-border);
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    position: relative;
}

/* ─── LABEL BADGE (non-clickable) ─── */
.tibsf-label-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    background: var(--tibsf-purple);
    color: #fff;
    border-radius: var(--tibsf-radius);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: default;
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
    flex-shrink: 0;
    height: 30px;
}
.tibsf-label-btn svg { flex-shrink: 0; stroke: currentColor; }

/* ─── SORT DROPDOWN ─── */
.tibsf-sort-wrap { flex-shrink: 0; position: relative; }

.tibsf-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--tibsf-white)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
        no-repeat right 8px center;
    padding: 0 28px 0 10px;
    border: 1.5px solid var(--tibsf-border);
    border-radius: var(--tibsf-radius);
    font-size: 12px;
    color: var(--tibsf-text);
    cursor: pointer;
    height: 32px;
    white-space: nowrap;
    transition: border-color var(--tibsf-trans), box-shadow var(--tibsf-trans);
    min-width: 130px;
    max-width: 175px;
}
.tibsf-select:focus {
    outline: none;
    border-color: var(--tibsf-purple);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ─── DIVIDER ─── */
.tibsf-divider {
    width: 1px;
    height: 22px;
    background: var(--tibsf-border);
    flex-shrink: 0;
}

/* ─── SEARCH — icon button that expands ─── */
.tibsf-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: width var(--tibsf-trans);
}

/* Icon-only trigger button */
.tibsf-search-trigger {
    width: 32px;
    height: 32px;
    border-radius: var(--tibsf-radius);
    border: 1.5px solid var(--tibsf-border);
    background: var(--tibsf-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--tibsf-trans);
    color: var(--tibsf-muted);
    padding: 0;
    position: relative;
    z-index: 2;
}
.tibsf-search-trigger svg { stroke: currentColor; pointer-events: none; }
.tibsf-search-trigger:hover,
.tibsf-search-trigger.active {
    border-color: var(--tibsf-purple);
    color: var(--tibsf-purple);
    background: #f5f3ff;
}
.tibsf-search-trigger .tibsf-dot {
    position: absolute;
    top: -3px; right: -3px;
    width: 7px; height: 7px;
    background: var(--tibsf-purple);
    border-radius: 50%;
    border: 1.5px solid var(--tibsf-white);
    display: none;
}
.tibsf-search-trigger .tibsf-dot.show { display: block; }

/* Expanding input panel (absolute, overlaps) */
.tibsf-search-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 220px;
    background: var(--tibsf-white);
    border: 1.5px solid var(--tibsf-border);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12);
    padding: 8px;
    display: none;
    z-index: 999;
    flex-direction: column;
    gap: 0;
}
.tibsf-search-panel.open { display: flex; }

.tibsf-search-inner {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid var(--tibsf-border);
    border-radius: var(--tibsf-radius);
    overflow: hidden;
    background: var(--tibsf-white);
    transition: border-color var(--tibsf-trans);
}
.tibsf-search-inner:focus-within {
    border-color: var(--tibsf-purple);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.tibsf-search-icon-inner {
    padding: 0 8px;
    color: var(--tibsf-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.tibsf-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 7px 4px 7px 0;
    font-size: 13px;
    color: var(--tibsf-text);
    background: transparent;
    min-width: 0;
}
.tibsf-search-input::placeholder { color: #9ca3af; }

.tibsf-search-clear {
    padding: 0 8px;
    background: none;
    border: none;
    color: var(--tibsf-muted);
    font-size: 16px;
    cursor: pointer;
    display: none;
    line-height: 1;
    transition: color var(--tibsf-trans);
}
.tibsf-search-clear:hover { color: #ef4444; }

/* ─── PRICE — compact icon + popover ─── */
.tibsf-price-wrap {
    position: relative;
    flex-shrink: 0;
}

.tibsf-price-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 10px;
    border: 1.5px solid var(--tibsf-border);
    border-radius: var(--tibsf-radius);
    background: var(--tibsf-white);
    color: var(--tibsf-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--tibsf-trans);
}
.tibsf-price-trigger svg { stroke: currentColor; flex-shrink: 0; }
.tibsf-price-trigger:hover,
.tibsf-price-trigger.active {
    border-color: var(--tibsf-purple);
    color: var(--tibsf-purple);
    background: #f5f3ff;
}
.tibsf-price-trigger .tibsf-dot {
    width: 6px; height: 6px;
    background: var(--tibsf-purple);
    border-radius: 50%;
    display: none;
    flex-shrink: 0;
}
.tibsf-price-trigger .tibsf-dot.show { display: inline-block; }

/* Price popover */
.tibsf-price-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 220px;
    background: var(--tibsf-white);
    border: 1.5px solid var(--tibsf-border);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12);
    padding: 12px;
    display: none;
    z-index: 999;
}
.tibsf-price-panel.open { display: block; }

.tibsf-price-panel-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tibsf-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.tibsf-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tibsf-price-field {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--tibsf-border);
    border-radius: var(--tibsf-radius);
    overflow: hidden;
    background: var(--tibsf-white);
    transition: border-color var(--tibsf-trans);
}
.tibsf-price-field:focus-within { border-color: var(--tibsf-purple); }

.tibsf-price-currency {
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--tibsf-muted);
    background: var(--tibsf-surface);
    border-right: 1px solid var(--tibsf-border);
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.tibsf-price-input {
    width: 100%;
    border: none;
    outline: none;
    padding: 6px 6px;
    font-size: 12px;
    color: var(--tibsf-text);
    background: transparent;
    -moz-appearance: textfield;
    text-align: center;
}
.tibsf-price-input::-webkit-outer-spin-button,
.tibsf-price-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.tibsf-price-input::placeholder { color: #9ca3af; }

.tibsf-price-sep {
    font-size: 13px;
    color: var(--tibsf-muted);
    flex-shrink: 0;
    font-weight: 600;
}

.tibsf-price-apply {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 7px;
    background: var(--tibsf-purple);
    color: #fff;
    border: none;
    border-radius: var(--tibsf-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background var(--tibsf-trans);
}
.tibsf-price-apply:hover { background: var(--tibsf-purple-dk); }

/* ─── RESET — icon only ─── */
.tibsf-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: #f3f4f6;
    color: #374151;
    border: 1.5px solid var(--tibsf-border);
    border-radius: var(--tibsf-radius);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--tibsf-trans);
    position: relative;
}
.tibsf-reset-btn svg { stroke: currentColor; pointer-events: none; }
.tibsf-reset-btn:hover {
    background: var(--tibsf-purple);
    color: #fff;
    border-color: var(--tibsf-purple);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(99,102,241,.35);
}
.tibsf-reset-btn:active { transform: translateY(0); }
.tibsf-reset-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
}

/* Spin on reset */
.tibsf-reset-btn.tibsf-resetting svg { animation: tibsf-spin .5s linear infinite; }

/* ─── SPACER / PUSH ─── */
.tibsf-spacer { flex: 1; }

/* ─── COUNT BAR ─── */
.tibsf-count-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    min-height: 18px;
}
.tibsf-count { font-size: 12px; color: var(--tibsf-muted); font-weight: 500; }
.tibsf-count strong { color: var(--tibsf-text); font-weight: 700; }
.tibsf-count--preview { color: #a5b4fc; font-style: italic; }

.tibsf-spinner {
    display: inline-flex;
    align-items: center;
}
.tibsf-spinner svg { animation: tibsf-spin .7s linear infinite; stroke: var(--tibsf-purple); }

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

/* ─── GRID STATES ─── */
.tibs-product-card {
    transition: opacity .18s ease, transform .18s ease !important;
}
.tibs-product-card.tibsf-hidden { display: none !important; }

/* No results inside grid */
.tibsf-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    color: var(--tibsf-muted);
}
.tibsf-no-results svg {
    width: 48px; height: 48px;
    stroke: #d1d5db;
    margin: 0 auto 14px;
    display: block;
}
.tibsf-no-results h3 { font-size: 15px; font-weight: 600; color: #374151; margin: 0 0 6px; }
.tibsf-no-results p  { font-size: 13px; margin: 0; }

/* ─── CLOSE POPOVERS ON OUTSIDE CLICK (visual only) ─── */
.tibsf-overlay-dismiss {
    position: fixed;
    inset: 0;
    z-index: 998;
    display: none;
}
.tibsf-overlay-dismiss.active { display: block; }

/* ─── EDITOR PREVIEW ─── */
.tibsf-editor-preview .tibsf-bar { pointer-events: auto; }
.tibsf-editor-preview .tibsf-label-btn { pointer-events: none; }

/* ─── RESPONSIVE ─── */
@media (max-width: 480px) {
    .tibsf-select { min-width: 110px; max-width: 130px; font-size: 11px; }
    .tibsf-label-btn { font-size: 10px; padding: 5px 8px; }
    .tibsf-bar { gap: 5px; padding: 0 10px; }
}
