/* ==========================================================================
   Tires Outlets - Header Quick Search
   Replaces the unreliable WooBeWoo filter widget with a fast, forgiving,
   custom-built tire size search. Matches the site's dark/ember theme.
   ========================================================================== */

.ts-quick-search {
    position: relative;
    width: 100%;
    max-width: 280px;
}

.ts-qs-wrap {
    position: relative;
    width: 100%;
}

/* Input row */
.ts-qs-input-row {
    display: flex;
    align-items: center;
    background: #1C1713;
    border: 2px solid rgba(237, 238, 236, 0.15);
    border-radius: 8px;
    padding: 0 10px;
    height: 42px;
    transition: border-color 0.15s ease;
}
.ts-qs-input-row:focus-within {
    border-color: #E8571C;
}

.ts-qs-icon {
    flex-shrink: 0;
    color: #8B857D;
    margin-right: 8px;
}
.ts-qs-input-row:focus-within .ts-qs-icon {
    color: #E8571C;
}

.ts-qs-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #EDEEEC;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, sans-serif;
    min-width: 0;
}
.ts-qs-input::placeholder {
    color: #6b6660;
    font-weight: 500;
}

.ts-qs-clear {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #8B857D;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}
.ts-qs-clear:hover { color: #E8571C; }

/* Dropdown */
.ts-qs-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1C1713;
    border: 1px solid rgba(237, 238, 236, 0.15);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    max-height: 360px;
    overflow-y: auto;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.ts-qs-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ts-qs-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(237, 238, 236, 0.08);
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    direction: ltr;
    transition: background 0.12s ease;
}
.ts-qs-item:last-child { border-bottom: none; }
.ts-qs-item:hover, .ts-qs-item:focus {
    background: rgba(232, 87, 28, 0.1);
    outline: none;
}

.ts-qs-item-size {
    font-family: 'Courier New', monospace;
    font-weight: 800;
    font-size: 15px;
    color: #EDEEEC;
    white-space: nowrap;
}

.ts-qs-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ts-qs-price {
    font-size: 12px;
    font-weight: 700;
    color: #F2A93B;
    white-space: nowrap;
}

.ts-qs-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}
.ts-qs-dot-in { background: #4CB27A; }
.ts-qs-dot-out { background: #c0392b; }

.ts-qs-stock {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.ts-qs-stock-in { color: #4CB27A; }
.ts-qs-stock-out { color: #c0392b; }

.ts-qs-empty, .ts-qs-hint {
    padding: 18px 16px;
    color: #8B857D;
    font-size: 13px;
    text-align: center;
}

/* Loading dots */
.ts-qs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 20px;
}
.ts-qs-loading span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #E8571C;
    animation: ts-qs-bounce 1s infinite ease-in-out;
}
.ts-qs-loading span:nth-child(2) { animation-delay: 0.15s; }
.ts-qs-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ts-qs-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* RTL / Arabic pages: dropdown labels can flow RTL, but the tire size
   itself always stays LTR (numbers/format never reverse) */
html[dir="rtl"] .ts-qs-input-row { direction: rtl; }
html[dir="rtl"] .ts-qs-icon { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .ts-qs-item { direction: rtl; text-align: right; }

/* Mobile - full width, comfortable tap targets */
@media (max-width: 549px) {
    .ts-quick-search { max-width: 100%; }
    .ts-qs-input-row { height: 46px; }
    .ts-qs-item { padding: 14px 14px; }
    .ts-qs-dropdown { max-height: 320px; }
}
