* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

/* Map layers - stacked, clipped */
#map-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.map-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#tum-map {
    z-index: 2;
    clip-path: inset(0 50% 0 0);  /* Show left half */
}

#osm-map {
    z-index: 1;
}

/* Swipe divider */
#swipe {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 44px;
    margin-left: -22px;
    z-index: 10;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
}

#swipe-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    margin-left: -1.5px;
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

#swipe-handle {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    color: #666;
}

/* Labels at bottom */
.map-label {
    position: absolute;
    bottom: 20px;
    z-index: 5;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    pointer-events: none;
}

#label-left {
    left: 50%;
    transform: translateX(-100%);
    margin-left: -10px;
    background: rgba(66, 100, 251, 0.9);
}

#label-right {
    left: 50%;
    transform: translateX(0%);
    margin-left: 10px;
    background: rgba(255, 107, 53, 0.9);
}

/* Controls */
#controls {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 16px;
    border-radius: 16px;
    z-index: 20;
    min-width: 240px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

#controls h1 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.credits {
    font-size: 0.65rem;
    margin-bottom: 12px;
    opacity: 0.7;
}

.credits a {
    color: #4264fb;
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

.credits span {
    margin: 0 4px;
    color: #666;
}

/* Search */
.search-container {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

#search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    background: #fff;
}

#search-input:focus {
    outline: none;
    border-color: #4264fb;
}

#search-btn {
    padding: 8px 14px;
    background: #4264fb;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

#search-btn:hover {
    background: #3254e0;
}

.location-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.location-buttons button {
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 16px;
    color: #333;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
}

.location-buttons button:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* Load button */
.load-btn {
    width: 100%;
    padding: 10px;
    background: #4264fb;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.15s;
}

.load-btn:hover {
    background: #3254e0;
}

.load-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
}

/* Stats */
.stats-container {
    display: flex;
    gap: 8px;
}

.stat-box {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.03);
}

.stat-box.tum { }
.stat-box.osm { }

.stat-box .label {
    font-size: 0.6rem;
    opacity: 0.5;
    text-transform: uppercase;
    color: #1a1a1a;
}

.stat-box .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.stat-box .sublabel {
    font-size: 0.65rem;
    opacity: 0.5;
    color: #1a1a1a;
}

/* Download section */
.download-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.download-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.5;
    color: #1a1a1a;
    display: block;
    margin-bottom: 6px;
}

.download-buttons {
    display: flex;
    gap: 6px;
}

.download-dropdown {
    flex: 1;
    position: relative;
}

.download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: #fff;
}

.download-btn.tum {
    background: rgba(66, 100, 251, 0.85);
}

.download-btn.tum:hover:not(:disabled) {
    background: rgba(66, 100, 251, 1);
}

.download-btn.osm {
    background: rgba(255, 107, 53, 0.85);
}

.download-btn.osm:hover:not(:disabled) {
    background: rgba(255, 107, 53, 1);
}

.download-btn:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: #999;
    cursor: not-allowed;
}

.download-btn svg {
    flex-shrink: 0;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 30;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    color: #1a1a1a;
    transition: background 0.1s;
}

.dropdown-menu button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dropdown-menu button:first-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Loading */
#loading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #666;
}

#loading.hidden { display: none; }

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #4264fb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Popup */
.maplibregl-popup-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    color: #1a1a1a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.maplibregl-popup-tip { display: none; }

.popup-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0;
}

.popup-row .label { opacity: 0.5; }

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.7rem;
    color: #fff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: toastIn 0.2s ease-out, toastOut 0.3s ease-in 3.7s forwards;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.error {
    background: rgba(220, 53, 69, 0.9);
}

.toast.warning {
    background: rgba(255, 193, 7, 0.85);
    color: #333;
}

.toast.info {
    background: rgba(66, 100, 251, 0.9);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Mobile */
@media (max-width: 600px) {
    #controls {
        left: 10px;
        right: 10px;
        min-width: auto;
    }

    .map-label {
        bottom: 14px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    #label-left {
        left: 50%;
        transform: translateX(-100%);
        margin-left: -6px;
    }
    #label-right {
        left: 50%;
        transform: translateX(0%);
        margin-left: 6px;
    }
}
