/* ============================================================
   unified-search.css
   Styles for the live grouped search dropdown.
   All values reference design-tokens.css variables — no hardcoded colours.
   ============================================================ */

/* ── Wrap & input bar ──────────────────────────────────────── */
.unified-search-wrap {
    position: relative;
    max-width: 700px;
    margin: auto;
    width: 100%;
}

.unified-search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: text;
}

.unified-search-wrap.active .unified-search-bar {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.usb-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.usb-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-family-base);
    padding: var(--space-2) 0;
    direction: rtl;
    min-width: 0;
}

.usb-input::placeholder {
    color: var(--text-muted);
}

.usb-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

/* Filter pill button */
.filter-pill-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-family: var(--font-family-base);
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}

.filter-pill-btn:hover,
.filter-pill-btn.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(99,102,241,0.08);
}

.filter-pill-label:not(:empty) {
    font-weight: 600;
    font-size: var(--text-xs);
}

/* Submit button */
.usb-submit {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-1);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.usb-submit:hover {
    color: var(--accent-color);
}

/* ── Dropdown ─────────────────────────────────────────────── */
#searchDropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    z-index: 1060;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    display: none;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
}

#searchDropdown.show {
    display: block;
}

/* Scrollbar */
#searchDropdown::-webkit-scrollbar { width: 5px; }
#searchDropdown::-webkit-scrollbar-track { background: transparent; }
#searchDropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* ── Group header ─────────────────────────────────────────── */
.sd-group {
    padding: var(--space-2) 0;
}

.sd-group-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.sd-group-header svg,
.sd-group-header i {
    width: 12px;
    height: 12px;
}

/* ── Result item ──────────────────────────────────────────── */
.sd-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.1s;
    cursor: pointer;
}

.sd-item:hover,
.sd-item--active {
    background: var(--bg-elevated);
}

/* Thumbnail wrapper — fixed size for all types */
.sd-thumb-wrap {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.sd-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Color swatch */
.sd-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    display: block;
}

/* User avatar fallback */
.sd-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* No-image placeholder */
.sd-icon-placeholder {
    color: var(--text-muted);
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Text body */
.sd-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sd-item-title {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-item-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Right-side meta (e.g. tag slug) */
.sd-item-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: auto;
}

/* ── Divider between groups ───────────────────────────────── */
.sd-divider {
    height: 1px;
    background: var(--border-subtle, var(--border-color));
    margin: var(--space-1) 0;
}

/* ── "See all" link ───────────────────────────────────────── */
.sd-more {
    display: block;
    padding: var(--space-1) var(--space-4);
    font-size: var(--text-xs);
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.1s;
}

.sd-more:hover { opacity: 0.8; }

/* ── Loading & empty states ───────────────────────────────── */
.sd-loading,
.sd-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.sd-empty svg,
.sd-empty i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sd-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: sd-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ── Filter panel (lang + color) ──────────────────────────── */
.usb-filter-panel {
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    padding: var(--space-3) var(--space-4);
    display: none;
}

.usb-filter-section {
    margin-bottom: var(--space-3);
}

.usb-filter-section:last-child {
    margin-bottom: 0;
}

.usb-filter-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.usb-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

/* Pill base */
.udrop-pill {
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-family: var(--font-family-base);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
    line-height: 1;
}

.udrop-pill:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.udrop-pill.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* Color swatch pill */
.udrop-color-pill {
    padding: var(--space-1) var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--swatch);
    border: 1px solid rgba(255,255,255,0.15);
    display: inline-block;
    flex-shrink: 0;
}

.udrop-color-pill.active {
    background: transparent;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 991px) {
    .filter-pill-label { display: none; }

    #searchDropdown {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        max-height: 65vh;
    }
}
