/**
 * TTFC Search - Autocomplete dropdown
 * משתלב מתחת ל-#search-form-container הקיים בכותרת.
 *
 * הערה: ה-theme מציב את #search-form-container ב-position: fixed,
 * לכן אנחנו לא דורסים את ה-position שלו - ה-dropdown מקבל position
 * relative ל-container הקיים (שהוא fixed = non-static).
 */

/* === כיוון רוחב תיבת החיפוש בכותרת === */
#search-form-container .search-form {
    max-width: 680px;
}

.ttfc-autocomplete {
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    inset-inline-end: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #d0d0d4;
    border-radius: 6px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100000;
    font-size: 14px;
    color: #1d2327;
    direction: rtl;
    text-align: right;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ttfc-autocomplete[hidden] {
    display: none;
}

.ttfc-suggest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #50575e;
    border-bottom: 1px solid #f0f0f1;
}

.ttfc-clear-recent {
    background: none;
    border: none !important;
    border-bottom: 0 !important;
    color: #273B6B;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: none !important;
}

.ttfc-clear-recent:hover,
.ttfc-clear-recent:focus,
.ttfc-clear-recent:focus-visible {
    color: #7183C0;
    text-decoration: none !important;
    border-bottom: 0 !important;
    outline: none;
}

.ttfc-suggest-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.ttfc-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-bottom: 0 !important;
    text-decoration: none !important;
    list-style: none;
}

.ttfc-suggest-item a,
.ttfc-suggest-item a:hover,
.ttfc-suggest-item a:focus,
.ttfc-suggest-item a:visited {
    border-bottom: 0 !important;
    text-decoration: none !important;
    color: inherit;
    background: transparent !important;
}

.ttfc-suggest-item.is-active,
.ttfc-suggest-item:hover {
    background: #7183C0;
    color: #ffffff;
}

.ttfc-suggest-item.is-active .ttfc-suggest-title,
.ttfc-suggest-item:hover .ttfc-suggest-title,
.ttfc-suggest-item.is-active .ttfc-suggest-meta,
.ttfc-suggest-item:hover .ttfc-suggest-meta,
.ttfc-suggest-item.is-active .ttfc-suggest-icon,
.ttfc-suggest-item:hover .ttfc-suggest-icon {
    color: #ffffff;
}

.ttfc-suggest-item.is-active mark,
.ttfc-suggest-item:hover mark {
    background: #ffd966;
    color: #1d2327;
}

.ttfc-suggest-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f1;
}

.ttfc-suggest-thumb-placeholder {
    display: inline-block;
    background: linear-gradient(transparent, transparent), #f0f0f1;
    background: #f0f0f1;
    position: relative;
}

.ttfc-suggest-thumb-placeholder::after {
    content: '';
    position: absolute;
    inset: 14px;
    border: 1.5px solid #c3c4c7;
    border-radius: 50%;
    border-inline-start-width: 0;
    transform: rotate(-45deg);
}

.ttfc-suggest-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ttfc-suggest-title {
    color: #1d2327;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ttfc-suggest-title mark {
    background: #fff5b1;
    color: inherit;
    font-weight: 700;
    padding: 0 1px;
    border-radius: 2px;
}

.ttfc-suggest-meta {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ttfc-suggest-icon {
    width: 18px;
    text-align: center;
    color: #8c8f94;
    font-size: 14px;
    flex-shrink: 0;
}

.ttfc-suggest-item-recent .ttfc-suggest-title {
    color: #2271b1;
}

.ttfc-suggest-showall,
.ttfc-suggest-showall:link,
.ttfc-suggest-showall:visited {
    display: block;
    padding: 10px 14px;
    text-align: center;
    border-top: 1px solid #f0f0f1;
    border-bottom: 0 !important;
    color: #273B6B;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ttfc-suggest-showall:hover,
.ttfc-suggest-showall:focus,
.ttfc-suggest-showall:focus-visible {
    background: rgba(113, 131, 192, 0.12);
    color: #273B6B;
    text-decoration: none !important;
    border-bottom: 0 !important;
    outline: none;
}

.ttfc-suggest-status {
    padding: 16px 14px;
    text-align: center;
    color: #646970;
    font-size: 13px;
}

.ttfc-suggest-status.is-error {
    color: #8a1f24;
}

/* === Dark theme support (אם האתר תומך) === */
@media (prefers-color-scheme: dark) {
    .ttfc-autocomplete[data-theme="dark"] {
        background: #1d2327;
        border-color: #2c3338;
        color: #f0f0f1;
    }
}

/* === Mobile === */
@media (max-width: 768px) {
    .ttfc-autocomplete {
        max-height: 60vh;
        font-size: 15px;
    }

    .ttfc-suggest-item {
        padding: 12px 14px;
    }

    .ttfc-suggest-thumb {
        width: 36px;
        height: 36px;
    }
}
