.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#controls {
    float: right;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 5px;
    max-width: 70%;
    flex-wrap: wrap;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    z-index: 10002;
    position: relative;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #ecf0f1;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile backdrop */
.mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.mobile-backdrop.active {
    display: block;
}

/* Hide map popups when mobile menu is open */
@media (max-width: 768px) {
    #controls.open ~ #mapContainer .leaflet-popup {
        display: none !important;
    }
    
    #controls.open ~ #mapContainer .leaflet-tooltip {
        display: none !important;
    }
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 14px;
    font-weight: 500;
    color: #ecf0f1;
    white-space: nowrap;
}

.control-group select {
    padding: 5px 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #2c3e50;
    min-width: 120px;
}

.control-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.control-group button {
    padding: 6px 12px;
    border: 1px solid #3498db;
    border-radius: 4px;
    background: #3498db;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group button:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.control-group button:active {
    transform: translateY(1px);
}

#exportData {
    background: #27ae60;
    border-color: #27ae60;
}

#exportData:hover {
    background: #229954;
    border-color: #229954;
}

/* Mobile responsive design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    #controls {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #2c3e50;
        flex-direction: column;
        gap: 0;
        margin: 0;
        padding: 60px 20px 20px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.3);
        transition: right 0.3s ease;
        z-index: 10001;
        overflow-y: auto;
    }
    
    #controls.open {
        right: 0;
    }
    
    .control-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        margin-bottom: 25px;
        padding-bottom: 20px;
        border-bottom: 1px solid #34495e;
    }
    
    .control-group:last-child {
        border-bottom: none;
    }
    
    .control-group label {
        font-size: 14px;
        margin-bottom: 5px;
        color: #ecf0f1;
        font-weight: 500;
    }
    
    .control-group select,
    .control-group button {
        width: 100%;
        min-width: auto;
        padding: 12px 15px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .button-group button {
        border-radius: 6px !important;
    }
    
    #header {
        padding: 15px 10px;
    }
    
    #header h1 {
        margin: 0;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    #controls {
        width: 260px;
        padding: 50px 15px 15px;
    }
    
    #header h1 {
        font-size: 16px;
    }
    
    .mobile-menu-toggle {
        width: 28px;
        height: 22px;
    }
}

/* Custom dropdown styling */
.control-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

/* Button group styling */
.button-group {
    display: flex;
    gap: 5px;
}

.button-group button {
    border-radius: 0;
    min-height: 44px; /* Touch-friendly minimum size */
}

.button-group button:first-child {
    border-radius: 4px 0 0 4px;
}

.button-group button:last-child {
    border-radius: 0 4px 4px 0;
}

/* Touch-friendly sizing for mobile */
@media (max-width: 768px) {
    .control-group select,
    .control-group button {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* Status indicator */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-loading {
    background: #f39c12;
    animation: pulse 1.5s infinite;
}

.status-ready {
    background: #27ae60;
}

.status-error {
    background: #e74c3c;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}