/**
 * Basemap Switcher (2D) — Hintergrundkarten-Wechsler als Karten-Overlay.
 * Immer senkrechte Ausrichtung (schicker + mobilfreundlich). Sitzt links,
 * dynamisch positioniert (per JS): neben dem offenen Ebenen-Panel, sonst
 * bündig rechts an der Modul-Buttonleiste (Iconbar). Die `left`-Transition
 * lässt ihn synchron mit der Sidebar mitwandern.
 */

.basemap-switcher {
    position: absolute;
    left: 10px;                   /* wird per JS dynamisch gesetzt */
    bottom: 34px;                 /* etwas Abstand über der OL-Attribution (analog zum linken Rand) */
    z-index: 900;
    display: flex;
    align-items: flex-end;
    font-family: inherit;
    user-select: none;
    transition: left 0.3s ease;   /* synchron zur Sidebar (transform 0.3s) */
}

/* Gemeinsame Kachel-Optik */
.basemap-switcher .bmsw-thumb {
    display: block;
    background-size: cover;
    background-position: center;
    background-color: #e9edf0;
    border-radius: 8px;
}

.basemap-switcher .bmsw-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa4ad;
    font-size: 16px;
    background-image: repeating-linear-gradient(45deg, #f2f4f6 0 6px, #e7ebee 6px 12px);
}

/* --- Eingeklappt: aktuelle Karte --- */
.basemap-switcher .bmsw-current {
    position: relative;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.basemap-switcher .bmsw-current:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.basemap-switcher .bmsw-current .bmsw-thumb {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}
.basemap-switcher .bmsw-current-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    line-height: 1.2;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}
.basemap-switcher .bmsw-current-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Ausgeklappt: senkrechte Liste aller Karten --- */
.basemap-switcher .bmsw-tray {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 100px);   /* im Viewport bleiben; wächst nach oben */
    overflow-y: auto;
}

.basemap-switcher.is-expanded .bmsw-current { display: none; }
.basemap-switcher.is-expanded .bmsw-tray { display: flex; }

/* Ein Eintrag: Vorschaubild links, Name rechts (kompakte Zeile) */
.basemap-switcher .bmsw-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 200px;
    padding: 3px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    text-align: left;
}
.basemap-switcher .bmsw-item:hover {
    background: #f2f5f8;
}
.basemap-switcher .bmsw-item .bmsw-thumb {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: border-color 0.12s ease;
}
.basemap-switcher .bmsw-item.is-active .bmsw-thumb {
    border-color: var(--primary-color, #0866B0);
}
.basemap-switcher .bmsw-item-name {
    font-size: 12px;
    line-height: 1.25;
    color: #333;
}
.basemap-switcher .bmsw-item.is-active .bmsw-item-name {
    color: var(--primary-color, #0866B0);
    font-weight: 600;
}

/* Mobil: etwas kleiner */
@media (max-width: 480px) {
    .basemap-switcher { bottom: 28px; }
    .basemap-switcher .bmsw-current { width: 52px; height: 52px; }
    .basemap-switcher .bmsw-item { width: 168px; }
    .basemap-switcher .bmsw-item .bmsw-thumb { width: 40px; height: 40px; }
}
