/* ==========================================
   SmartSearch — natural-language header search
   Palette matches site: #214964 primary, #ffc637 accent, #2676aa secondary
   ========================================== */

.smart-search {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.smart-search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0 6px 0 18px;
    height: 46px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.smart-search-box:focus-within {
    border-color: #ffc637;
    box-shadow: 0 0 0 4px rgba(255, 198, 55, 0.22), 0 4px 14px rgba(0, 0, 0, 0.14);
}

.smart-search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #5a6975;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.smart-search-icon svg { width: 100%; height: 100%; }

.smart-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    height: 100%;
    font-size: 15px;
    font-family: inherit;
    color: #1f2d3d;
    min-width: 0;
}

.smart-search-input::placeholder {
    color: #aab2bb;
    font-weight: 400;
}

.smart-search-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #aab2bb;
    cursor: pointer;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.smart-search-clear svg { width: 16px; height: 16px; }
.smart-search-clear:hover { background: #f1f4f8; color: #1f2d3d; }
.smart-search-box.has-text .smart-search-clear { display: inline-flex; }

.smart-search-submit {
    flex-shrink: 0;
    height: 36px;
    padding: 0 18px;
    border: none;
    background: linear-gradient(135deg, #214964 0%, #2676aa 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    font-family: inherit;
}
.smart-search-submit:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(33, 73, 100, 0.28); }
.smart-search-submit:active { transform: translateY(0); }
.smart-search-submit-icon { width: 16px; height: 16px; }

/* Dropdown panel */
.smart-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 1100;
    animation: smart-search-fade-in 0.18s ease-out;
}

@keyframes smart-search-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.smart-search-section {
    padding: 14px 18px 12px;
    border-bottom: 1px solid #f1f4f8;
}
.smart-search-section:last-of-type { border-bottom: none; }

.smart-search-section-label {
    font-size: 11px;
    color: #5a6975;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.smart-search-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.smart-search-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f7ff;
    color: #214964;
    border: 1px solid #d6e7f7;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    height: 24px;
}

.smart-search-chip[data-type="price"]    { background: #ecfdf5; color: #047857; border-color: #c1e9d9; }
.smart-search-chip[data-type="distance"] { background: #fff7ed; color: #c2410c; border-color: #fbd9b6; }
.smart-search-chip[data-type="time"]     { background: #fef3c7; color: #92400e; border-color: #fbe098; }
.smart-search-chip[data-type="category"] { background: #ede9fe; color: #5b21b6; border-color: #d9d2f7; }
.smart-search-chip[data-type="make"]     { background: #fef2f2; color: #b91c1c; border-color: #f8d2d2; }
.smart-search-chip[data-type="state"]    { background: #f0f9ff; color: #0369a1; border-color: #c7e3f5; }
.smart-search-chip[data-type="status"]   { background: #fafafa; color: #404040; border-color: #e5e5e5; }
.smart-search-chip[data-type="year"]     { background: #fdf4ff; color: #86198f; border-color: #f3d2f8; }

.smart-search-chip-icon { width: 11px; height: 11px; }

.smart-search-suggestions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.smart-search-suggestion {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: #1f2d3d;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.smart-search-suggestion::before {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6975' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cpolyline points='9 21 3 21 3 15'/%3E%3Cline x1='21' y1='3' x2='14' y2='10'/%3E%3Cline x1='3' y1='21' x2='10' y2='14'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.5;
}
.smart-search-suggestion:hover { background: #f0f7ff; color: #214964; }
.smart-search-suggestion:hover::before { opacity: 1; }

.smart-search-footer {
    padding: 10px 18px;
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #5a6975;
}
.smart-search-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    background: #ffffff;
    border: 1px solid #e1e7ee;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    color: #1f2d3d;
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.smart-search-advanced-link {
    color: #2676aa;
    text-decoration: none;
    font-weight: 600;
}
.smart-search-advanced-link:hover { text-decoration: underline; color: #214964; }

/* Mobile */
@media (max-width: 640px) {
    .smart-search-box { height: 42px; padding: 0 4px 0 14px; }
    .smart-search-input { font-size: 14px; }
    .smart-search-submit-text { display: none; }
    .smart-search-submit { width: 36px; padding: 0; justify-content: center; }
    .smart-search-panel { left: -8px; right: -8px; }
    .smart-search-suggestion { font-size: 13px; }
    .smart-search-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* Dark mode */
[data-theme="dark"] .smart-search-box {
    background: var(--bg-surface, #1a2533);
    border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .smart-search-input { color: var(--text-heading, #f1f5f9); }
[data-theme="dark"] .smart-search-input::placeholder { color: var(--text-muted, #64748b); }
[data-theme="dark"] .smart-search-icon { color: var(--text-secondary, #a8b2bc); }
[data-theme="dark"] .smart-search-clear:hover { background: var(--bg-surface-hover, #243240); color: var(--text-heading, #f1f5f9); }
[data-theme="dark"] .smart-search-panel {
    background: var(--bg-surface, #1a2533);
    border-color: var(--border-color, #2d3a4a);
    box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}
[data-theme="dark"] .smart-search-section { border-bottom-color: var(--border-color, #2d3a4a); }
[data-theme="dark"] .smart-search-section-label { color: var(--text-secondary, #a8b2bc); }
[data-theme="dark"] .smart-search-suggestion { color: var(--text-heading, #f1f5f9); }
[data-theme="dark"] .smart-search-suggestion:hover { background: var(--bg-surface-hover, #243240); color: #ffc637; }
[data-theme="dark"] .smart-search-footer { background: var(--bg-surface-alt, #16202c); color: var(--text-secondary, #a8b2bc); }
[data-theme="dark"] .smart-search-footer kbd { background: var(--bg-surface, #1a2533); border-color: var(--border-color, #2d3a4a); color: var(--text-heading, #f1f5f9); }
