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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2000;
}

.mobile-toggle {
    display: none;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

.container {
    display: flex;
    min-height: calc(100vh - 80px);
    gap: 0;
}

.sidebar {
    width: 350px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    padding: 20px;
    position: relative;
    z-index: 50;
}

.map-container {
    flex: 1;
    position: relative;
    background: #e0e0e0;
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-group:hover {
    background: #f5f5f5;
}

.checkbox-group input[type="checkbox"],
.checkbox-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-group label {
    cursor: pointer;
    font-size: 14px;
    color: #555;
    flex: 1;
}

.submenu {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
}

.submenu-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.submenu-content {
    margin-top: 8px;
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

button {
    flex: 1;
    min-width: 100px;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.info-panel {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

.info-item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-weight: 600;
    color: #333;
}

.info-value {
    color: #667eea;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.slider-group {
    margin-top: 10px;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.feature-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.feature-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 12px;
}

.feature-item:hover {
    background: #f5f5f5;
}

.feature-item.active {
    background: #e8eef9;
    color: #667eea;
    font-weight: 600;
}

.popup-title {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.popup-field {
    margin: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}

.popup-label {
    font-weight: 600;
    color: #333;
}

.popup-value {
    color: #666;
    text-align: right;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        min-height: calc(100vh - 60px);
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        top: var(--header-h, 60px);
        width: 100%;
        max-height: calc(100dvh - var(--header-h, 60px));
        overflow-y: auto;
        transform: translateY(-110%);
        transition: transform 0.25s ease;
        z-index: 1500;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        background: #fff;
        box-shadow: 0 6px 18px rgba(0,0,0,0.15);
        overscroll-behavior: contain;
    }

    .sidebar.open {
        transform: translate3d(0,0,0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        will-change: transform, opacity;
    }

    .map-container {
        z-index: 1;
        min-height: calc(100dvh - var(--header-h, 60px));
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .header h1 {
        font-size: 20px;
    }

    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        right: 12px;
        top: 12px;
        padding: 8px 10px;
        background: rgba(255,255,255,0.18);
        color: #fff;
        border: 1px solid rgba(255,255,255,0.35);
        border-radius: 6px;
        font-size: 12px;
        font-weight: 600;
        backdrop-filter: blur(4px);
        z-index: 1100;
    }

    .mobile-overlay {
        position: fixed;
        left: 0;
        right: 0;
        top: var(--header-h, 60px);
        bottom: 0;
        background: rgba(0,0,0,0.25);
        backdrop-filter: blur(2px);
        z-index: 1400;
        display: none;
    }

    .mobile-overlay.active {
        display: block;
        pointer-events: all;
        touch-action: none;
    }

    .sidebar.open ~ .map-container #map {
        pointer-events: none;
        touch-action: none;
    }

    html.menu-open, body.menu-open {
        overflow: hidden;
        height: 100dvh;
    }
}