/*
 * MapController — shared visual chrome (search bar, switch buttons, badge).
 * Plum #7C4D71. Glassmorphism per project design tokens.
 */

/* Search wrapper sits inside the map container, top-left. */
.map-search-wrapper {
    width: 280px;
    max-width: calc(100% - 24px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(124, 77, 113, 0.2);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.map-search-wrapper input {
    width: 100%;
    border: 1px solid rgba(124, 77, 113, 0.18);
    background: white;
    color: #1f2937;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.map-search-wrapper input:focus {
    border-color: rgba(124, 77, 113, 0.6);
    box-shadow: 0 0 0 3px rgba(124, 77, 113, 0.15);
}

.map-search-results {
    margin-top: 6px;
    max-height: 240px;
    overflow-y: auto;
    border-radius: 6px;
    display: none;
    background: white;
    border: 1px solid rgba(124, 77, 113, 0.15);
}
.map-search-results.is-open { display: block; }

.map-search-results .map-search-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(124, 77, 113, 0.08);
    font-size: 12.5px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.12s ease;
}
.map-search-results .map-search-result:last-child { border-bottom: 0; }
.map-search-results .map-search-result:hover {
    background: rgba(124, 77, 113, 0.08);
    color: #5a3452;
}

.map-search-empty {
    padding: 10px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* Provider switch — friendly buttons (public) and stronger admin variant share base. */
.map-switch {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: inline-flex;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(124, 77, 113, 0.2);
    border-radius: 999px;
    padding: 3px;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.map-switch button {
    appearance: none;
    border: 0;
    background: transparent;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.map-switch button:hover { color: #5a3452; }
.map-switch button.is-active {
    background: linear-gradient(135deg, #7c4d71 0%, #5a3452 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(90, 52, 82, 0.3);
}

[data-map-provider-badge] {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.92);
    color: #5a3452;
    border: 1px solid rgba(124, 77, 113, 0.2);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    pointer-events: none;
}

/* Dark theme tweaks */
html[data-theme="dark"] .map-search-wrapper {
    background: rgba(30, 25, 36, 0.92);
    border-color: rgba(157, 107, 144, 0.3);
}
html[data-theme="dark"] .map-search-wrapper input {
    background: rgba(15, 12, 20, 0.85);
    color: #f4f1f8;
    border-color: rgba(157, 107, 144, 0.3);
}
html[data-theme="dark"] .map-search-results {
    background: rgba(20, 15, 25, 0.95);
    border-color: rgba(157, 107, 144, 0.25);
}
html[data-theme="dark"] .map-search-results .map-search-result {
    color: #f4f1f8;
    border-bottom-color: rgba(157, 107, 144, 0.18);
}
html[data-theme="dark"] .map-search-results .map-search-result:hover {
    background: rgba(157, 107, 144, 0.18);
    color: #fff;
}
html[data-theme="dark"] .map-switch {
    background: rgba(30, 25, 36, 0.92);
    border-color: rgba(157, 107, 144, 0.3);
}
html[data-theme="dark"] .map-switch button { color: #d6c2cf; }
html[data-theme="dark"] [data-map-provider-badge] {
    background: rgba(30, 25, 36, 0.92);
    color: #f4f1f8;
    border-color: rgba(157, 107, 144, 0.3);
}

/* Mobile reposition */
@media (max-width: 640px) {
    .map-search-wrapper { width: calc(100% - 24px); }
    .map-switch { top: auto; right: 12px; bottom: 48px; }
}
