/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f8f9fa;
    overflow-x: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    max-width: 100%;
}

.header-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.header-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Compact Controls */
.controls-container {
    background: white;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

/* Timeline Section */
.timeline-section {
    flex: 1;
    max-width: 500px;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.timeline-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    min-width: 60px;
}

.timeline-range-display {
    font-weight: 500;
    color: #2c3e50;
    min-width: 80px;
    font-size: 0.9rem;
}

.timeline-stats {
    font-size: 0.8rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

.timeline-slider {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}

.timeline-track {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    position: relative;
}

.timeline-range {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 2px;
    position: absolute;
}

.timeline-handle {
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #3498db;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.timeline-handle:hover {
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}


/* Filters Section */
.filters-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.filter-group select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    min-width: 90px;
}

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

/* Mountain Header CSS-only placeholder - add this to enhanced-styles.css */
.css-mountain-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

.mountain-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.css-mountain-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Ensure proper height cascading */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Main Container - Map takes priority */
.main-container {
    display: flex;
    /* Use viewport height minus header and controls */
    height: calc(100vh - 140px);
    min-height: 500px; /* Fallback minimum */
}

/* Ensure map container takes full available space */
.map-container {
    flex: 1;
    position: relative;
    min-width: 0;
    min-height: 500px; /* Minimum height fallback */
}


/* Force map to fill container */
#map {
    width: 100% !important;
    height: 100% !important;
    min-height: 500px !important; /* Critical: minimum height */
    background: #f8f9fa;
    position: relative;
}

/* Alternative fix if flex doesn't work */
@supports not (height: calc(100vh - 140px)) {
    .main-container {
        height: 600px; /* Fallback for older browsers */
    }
}

/* Ensure Leaflet container gets proper dimensions */
.leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 500px !important;
}


/* Compact Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: white;
    border-left: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.btn-back {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #5a6268;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0; /* Remove padding to fix blue border issue */
}

/* Add padding to content inside sidebar */
.mountain-summary {
    padding: 1.5rem;
}

.sidebar-placeholder {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.sidebar-placeholder p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.sidebar-placeholder small {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Mountain header styling */
.mountain-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.mountain-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.mountain-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.info-label {
    font-weight: 500;
    color: #6c757d;
}

.info-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .timeline-section {
        max-width: none;
    }
    
    .filters-section {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .header-content {
        padding: 0.5rem 1rem;
    }
    
    .header-title {
        font-size: 1.2rem;
    }
    
    .controls-container {
        padding: 0.5rem 1rem;
    }
    
    .main-container {
        flex-direction: column;
        height: calc(100vh - 160px);
    }

    .map-container {
        height: 60vh;
        min-height: 400px;
    }

    #map {
        min-height: 400px !important;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: 40vh;
        border-left: none;
        border-top: 1px solid #e9ecef;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    }
    
    
    .timeline-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .filters-section {
        gap: 0.75rem;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .header-nav {
        gap: 0.5rem;
    }
    
    .timeline-section {
        margin-bottom: 0.5rem;
    }
    
    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }
}