/* ============================================
   Leipzig Swimming Pools Map
   ============================================ */

.lsm-wrapper {
    --lsm-color: #0ea5e9;
    --lsm-size: 16px;
    --lsm-accent: #0ea5e9;
    --lsm-radius: 16px;
    --lsm-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: relative;
    font-family: var(--lsm-font);
    border-radius: var(--lsm-radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
}

.lsm-map {
    width: 100%;
    z-index: 1;
    border-radius: var(--lsm-radius);
}

/* --- Search Bar --- */
.lsm-search-bar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 420px;
}

.lsm-search-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 50px;
    padding: 10px 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.lsm-search-inner:focus-within {
    border-color: var(--lsm-accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,.12), 0 2px 12px rgba(0,0,0,.08);
}

.lsm-search-icon {
    width: 18px;
    height: 18px;
    color: #94a3b8;
    flex-shrink: 0;
}

.lsm-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #1e293b;
    font-size: 14px;
    font-family: var(--lsm-font);
    min-width: 0;
}

.lsm-search-input::placeholder { color: #94a3b8; }

.lsm-search-count {
    font-size: 12px;
    color: var(--lsm-accent);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.lsm-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.06);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background .2s ease;
}

.lsm-search-clear svg { width: 14px; height: 14px; color: #64748b; }
.lsm-search-clear:hover { background: rgba(0,0,0,.1); }

/* --- Stats Bar --- */
.lsm-stats-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 50px;
    padding: 8px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

.lsm-stat { display: flex; align-items: center; gap: 6px; }
.lsm-stat svg { width: 16px; height: 16px; color: var(--lsm-accent); flex-shrink: 0; }
.lsm-stat-value { font-size: 16px; font-weight: 700; color: #1e293b; }
.lsm-stat-label { font-size: 12px; color: #64748b; font-weight: 500; }
.lsm-stat-divider { width: 1px; height: 20px; background: rgba(0,0,0,.1); }

/* --- Marker Styles --- */
@keyframes lsm-pulse {
    0%   { box-shadow: 0 0 4px 0 rgba(14,165,233,.7); }
    70%  { box-shadow: 0 0 6px 12px rgba(14,165,233,0); }
    100% { box-shadow: 0 0 4px 0 rgba(14,165,233,0); }
}

.lsm-marker { transition: transform .2s ease; }
.lsm-marker:hover { transform: scale(1.3); }

.lsm-marker-dot {
    width: var(--lsm-size);
    height: var(--lsm-size);
    background: var(--lsm-color);
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 0 6px 2px rgba(14,165,233,.45), 0 1px 4px rgba(0,0,0,.25);
    transition: transform .2s ease;
    animation: lsm-pulse 2s ease-out infinite;
    position: relative;
}

.lsm-marker-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    background: rgba(255,255,255,.6);
    border-radius: 50%;
}

.lsm-marker-dot:hover {
    transform: scale(1.4);
    box-shadow: 0 0 10px 4px rgba(14,165,233,.6), 0 1px 4px rgba(0,0,0,.3);
    animation: lsm-pulse .9s ease-out infinite;
}

/* Freibad markers — sunny gold */
.lsm-marker-dot.lsm-freibad {
    background: #f59e0b;
    box-shadow: 0 0 6px 2px rgba(245,158,11,.45), 0 1px 4px rgba(0,0,0,.25);
}

/* --- Info Panel (fixed overlay — no map jank) --- */
.lsm-info-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 60px;
    width: 320px;
    max-height: calc(100% - 80px);
    z-index: 1002;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* slide-in transition */
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.lsm-info-panel.lsm-info-visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.lsm-info-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,.06);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background .2s ease;
}

.lsm-info-close svg { width: 16px; height: 16px; color: #64748b; }
.lsm-info-close:hover { background: rgba(0,0,0,.12); }

.lsm-info-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Active marker highlight */
.lsm-marker-dot.lsm-active {
    transform: scale(1.5);
    box-shadow: 0 0 12px 5px rgba(14,165,233,.6), 0 1px 4px rgba(0,0,0,.3);
    animation: none;
    z-index: 10;
}

.lsm-marker-dot.lsm-freibad.lsm-active {
    box-shadow: 0 0 12px 5px rgba(245,158,11,.6), 0 1px 4px rgba(0,0,0,.3);
}

/* --- Tooltip card (inside info panel) --- */
.lsm-tooltip {
    border-radius: 0;
    border: none;
    border-left: 4px solid var(--lsm-accent);
    padding: 20px 18px 16px;
    color: #1e293b;
    font-family: var(--lsm-font);
    background: transparent;
}

.lsm-tooltip-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
    color: #0f172a;
}

.lsm-tooltip-address {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 10px;
    line-height: 1.4;
}

.lsm-tooltip-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.lsm-tooltip-type.lsm-type-hallenbad {
    background: rgba(14,165,233,.1);
    color: #0284c7;
}

.lsm-tooltip-type.lsm-type-freibad {
    background: rgba(245,158,11,.1);
    color: #d97706;
}

.lsm-tooltip-type.lsm-type-erlebnis {
    background: rgba(139,92,246,.1);
    color: #7c3aed;
}

.lsm-tooltip-type.lsm-type-naturbad {
    background: rgba(34,197,94,.1);
    color: #16a34a;
}

.lsm-tooltip-section {
    margin-bottom: 10px;
}

.lsm-tooltip-section:last-of-type {
    margin-bottom: 12px;
}

.lsm-tooltip-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lsm-tooltip-section-title svg {
    width: 12px;
    height: 12px;
}

.lsm-tooltip-section-body {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

.lsm-tooltip-details {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    margin: 0 0 10px;
}

.lsm-tooltip-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--lsm-accent);
    text-decoration: none;
    transition: opacity .2s ease;
}

.lsm-tooltip-link:hover { opacity: .75; }

/* --- Cluster Icons --- */
.lsm-cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-family: var(--lsm-font);
    border: 3px solid rgba(255,255,255,.7);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: transform .2s ease;
}

.lsm-cluster-icon:hover { transform: scale(1.1); }

.lsm-cluster-small {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    font-size: 12px;
}

.lsm-cluster-medium {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    font-size: 13px;
}

.lsm-cluster-large {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    font-size: 14px;
}

/* --- Controls --- */
.lsm-wrapper .leaflet-control-zoom {
    border: none !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.1) !important;
}

.lsm-wrapper .leaflet-control-zoom a {
    background: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #334155 !important;
    border: none !important;
    border-bottom: 1px solid rgba(0,0,0,.06) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    transition: background .2s ease, color .2s ease;
}

.lsm-wrapper .leaflet-control-zoom a:last-child { border-bottom: none !important; }
.lsm-wrapper .leaflet-control-zoom a:hover {
    background: #fff !important;
    color: var(--lsm-accent) !important;
}

.lsm-fullscreen-btn {
    position: absolute;
    top: 80px;
    left: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: background .2s ease;
    padding: 0;
}

.lsm-fullscreen-btn svg { width: 18px; height: 18px; color: #334155; transition: color .2s ease; }
.lsm-fullscreen-btn:hover { background: #fff; }
.lsm-fullscreen-btn:hover svg { color: var(--lsm-accent); }

/* --- Reset Zoom Button --- */
.lsm-reset-btn {
    position: absolute;
    top: 124px;
    left: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: background .2s ease, transform .15s ease;
    padding: 0;
}

.lsm-reset-btn svg {
    width: 18px;
    height: 18px;
    color: #334155;
    transition: color .2s ease;
}

.lsm-reset-btn:hover {
    background: #fff;
    transform: scale(1.05);
}

.lsm-reset-btn:hover svg {
    color: var(--lsm-accent);
}

.lsm-reset-btn:active {
    transform: scale(0.95);
}

.lsm-wrapper.lsm-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
}

.lsm-wrapper.lsm-fullscreen .lsm-map {
    height: 100vh !important;
    border-radius: 0;
}

/* --- Loading --- */
.lsm-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: var(--lsm-radius);
    transition: opacity .3s ease;
}

.lsm-loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(0,0,0,.08);
    border-top-color: var(--lsm-accent);
    border-radius: 50%;
    animation: lsm-spin .8s linear infinite;
}

@keyframes lsm-spin { to { transform: rotate(360deg); } }
.lsm-loading.lsm-hidden { opacity: 0; pointer-events: none; }

/* --- Attribution --- */
.lsm-wrapper .leaflet-control-attribution {
    background: rgba(255,255,255,.8) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #94a3b8 !important;
    font-size: 10px !important;
    border-radius: 8px 0 0 0;
}

.lsm-wrapper .leaflet-control-attribution a { color: #64748b !important; }

/* --- Responsive --- */
@media (max-width: 600px) {
    .lsm-search-bar { width: 92%; top: 10px; }
    .lsm-search-inner { padding: 8px 14px; }
    .lsm-search-input { font-size: 13px; }
    .lsm-stats-bar { bottom: 10px; padding: 6px 14px; gap: 10px; }
    .lsm-stat-value { font-size: 14px; }
    .lsm-stat-label { font-size: 11px; }
    .lsm-tooltip { min-width: auto; max-width: none; padding: 16px 14px 12px; }
    .lsm-reset-btn { top: 114px; }

    /* Info panel → bottom sheet on mobile */
    .lsm-info-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 55%;
        border-radius: 16px 16px 0 0;
        transform: translateY(20px);
    }
    .lsm-info-panel.lsm-info-visible {
        transform: translateY(0);
    }
}
