/* Search box - fixed position over map, Google Maps style */

.search-container {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 328px;
    height: 44px;
    background: rgba(36, 38, 56, 0.92);
    border-radius: 22px;
    padding: 0 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
    .search-container {
        background: rgba(36, 38, 56, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    min-width: 0;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Clear button and spinner share the same slot */
.search-clear {
    display: none;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0 0 2px 0;
}

.search-clear.visible {
    display: flex;
}

.search-clear:hover {
    color: rgba(255, 255, 255, 0.8);
}

.search-spinner {
    display: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0 5px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    cursor: pointer;
}

.search-spinner.active {
    display: block;
    animation: search-spin 0.6s linear infinite;
}

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

/* Search submit button (magnifying glass, right side) */
.search-submit {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-submit svg {
    width: 18px;
    height: 18px;
}

.search-submit:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Dropdown results - separate from search container to avoid iOS overflow */
.search-dropdown {
    display: none;
    position: fixed;
    top: 66px;
    left: 16px;
    width: 328px;
    box-sizing: border-box;
    z-index: 100;
    background: rgba(30, 32, 50, 0.95);
    border-radius: 12px;
    padding: 4px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-height: 300px;
    overflow-y: auto;
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
    .search-dropdown {
        background: rgba(30, 32, 50, 0.82);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

.search-dropdown.visible {
    display: block;
}

.search-result {
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    cursor: pointer;
}

.search-result:hover,
.search-result.active {
    background: rgba(255, 255, 255, 0.08);
}

.search-no-results {
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 13px;
    font-style: italic;
}

/* Mobile */
@media (max-width: 800px) {
    .search-container {
        width: auto;
        right: 16px;
    }

    .search-input {
        font-size: 16px;  /* prevents iOS Safari auto-zoom on focus */
    }

    .search-dropdown {
        width: auto;
        right: 16px;
    }
}
