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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Styles */
header {
    background: #E8EAED;
    color: #5F6368;
    padding: 0.875rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
    position: relative;
    border-bottom: 1px solid #DADCE0;
}

header h1 {
    display: none; /* Hide title - let map speak for itself */
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 1px solid #DADCE0;
    color: #5F6368;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #F8F9FA;
    border-color: #1A73E8;
}

.filter-btn.active {
    background: #1A73E8;
    color: white;
    border-color: #1A73E8;
}

.last-update {
    margin-left: auto;
    font-size: 0.8rem;
    color: #5F6368;
    font-weight: 500;
}

/* Map Container */
#map {
    flex: 1;
    position: relative;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(235, 235, 235, 0.85) !important;
    backdrop-filter: none !important;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1;
    max-width: 220px;
    border: 1px solid rgba(0,0,0,0.08);
}

.legend h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #5F6368;
    border-bottom: 2px solid #9AA0A6;
    padding-bottom: 0.5rem;
}

.legend h4 {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #424242;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0.4rem 0;
    font-size: 0.8rem;
    color: #424242;
}

/* Desktop: show full labels, hide short */
.legend-label-full {
    display: inline;
}

.legend-label-short {
    display: none;
}

.legend-color {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* Desktop: Closed gets dark border like on map */
.legend-item:first-child .legend-color {
    background: #D5D8DC !important;
    border: 2px solid #424242 !important;
}

/* Desktop: Open resorts get white border like on map */
.legend-item:not(:first-child) .legend-color {
    border: 2px solid #F5F5F5 !important;
}

.legend-note {
    font-size: 0.75rem;
    color: #757575;
    margin-top: 0.5rem;
    font-style: italic;
}

.size-examples {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    gap: 0.75rem;
}

.size-example {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.size-circle {
    background: #D5D8DC;
    border-radius: 50%;
    border: 2px solid #424242;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.size-example span {
    font-size: 0.7rem;
    color: #5F6368;
    font-weight: 500;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E3F2FD;
    border-top: 4px solid #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 1rem;
    color: #666;
    font-size: 0.875rem;
}

/* Marker Styling */
.custom-marker {
    display: block;
    position: absolute;
    transition: width 0.2s ease, height 0.2s ease, box-shadow 0.2s ease;
}

.mapboxgl-marker {
    /* Prevent any weird positioning issues */
}

/* Mapbox Popup Customization */
.mapboxgl-popup {
    max-width: 320px;
}

.mapboxgl-popup-content {
    padding: 0.875rem;
    min-width: 240px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    font-family: inherit;
}

.mapboxgl-popup-close-button {
    font-size: 1.25rem;
    padding: 0.25rem;
    color: #5F6368;
    right: 0.5rem;
    top: 0.5rem;
    outline: none !important;
}

.mapboxgl-popup-close-button:hover {
    background: #F8F9FA;
    color: #202124;
}

.mapboxgl-popup-close-button:focus {
    outline: none !important;
    box-shadow: none !important;
}

.popup-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #202124;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.popup-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-status.open {
    background: #1A73E8;
    color: white;
}

.popup-status.closed {
    background: #E8EAED;
    color: #5F6368;
}

.popup-section {
    margin: 0.2rem 0;
    padding: 0.15rem 0;
    border-top: 1px solid #F1F3F4;
}

.popup-section:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.popup-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #5F6368;
    margin-bottom: 0.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.popup-data {
    display: flex;
    justify-content: space-between;
    margin: 0.1rem 0;
    font-size: 0.85rem;
    align-items: center;
    line-height: 1.3;
}

.popup-data-label {
    color: #5F6368;
    font-weight: 400;
}

.popup-data-value {
    font-weight: 600;
    color: #202124;
    font-size: 0.85rem;
}

.popup-footer {
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid #F1F3F4;
    font-size: 0.7rem;
    color: #80868B;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
    }
    
    header h1 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
        flex: 0 0 auto;
    }
    
    .last-update {
        width: auto;
        margin-left: auto;
        margin-top: 0;
        font-size: 0.65rem;
        white-space: nowrap;
        flex: 0 0 auto;
    }
    
    /* Stacked legend at bottom on mobile */
    .legend {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: none;
        padding: 0.4rem 0.6rem 0.6rem 0.6rem;
        background: rgba(235, 235, 235, 0.94) !important;
        backdrop-filter: none !important;
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        border-radius: 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
        border: none;
        border-top: 1px solid rgba(0,0,0,0.08);
    }
    
    .legend h3 {
        display: block;
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
        font-weight: 700;
        color: #5F6368;
        border-bottom: 1px solid #9AA0A6;
        padding-bottom: 0.25rem;
    }
    
    .legend h4 {
        display: block;
        font-size: 0.6rem;
        margin-bottom: 0.25rem;
        font-weight: 600;
        color: #5F6368;
    }
    
    /* Color scale - horizontal row on top */
    .legend-scale {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        align-items: center;
        justify-content: space-around;
        overflow-x: auto;
    }
    
    .legend-item {
        font-size: 0.58rem;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        flex: 1 1 0;
        text-align: center;
        min-width: 0;
    }
    
    /* Mobile: hide full labels, show short abbreviated labels */
    .legend-label-full {
        display: none !important;
    }
    
    .legend-label-short {
        display: block !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    .legend-color {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }
    
    /* Size examples - horizontal row below with divider */
    .legend-size {
        border-top: 1px solid rgba(0,0,0,0.1);
        border-left: none;
        padding-top: 0.4rem;
        padding-left: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 0.6rem;
    }
    
    .size-examples {
        display: flex;
        flex-direction: row;
        gap: 0.4rem;
        align-items: center;
        justify-content: space-evenly;
        flex: 1;
        width: 100%;
    }
    
    .size-example {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        flex: 1 1 0;
    }
    
    .size-example span {
        font-size: 0.58rem;
        line-height: 1;
        white-space: nowrap;
    }
    
    .size-circle {
        flex-shrink: 0;
    }
    
    /* Compact mobile popups */
    .mapboxgl-popup-content {
        min-width: 190px;
        padding: 0.35rem;
        font-size: 0.8rem;
    }
    
    .popup-header {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
        line-height: 1.1;
    }
    
    .popup-status {
        padding: 0.15rem 0.45rem;
        font-size: 0.58rem;
        margin-bottom: 0.3rem;
    }
    
    .popup-section {
        margin-bottom: 0.3rem;
    }
    
    .popup-label {
        font-size: 0.58rem;
        margin-bottom: 0.2rem;
    }
    
    .popup-data {
        margin-bottom: 0.15rem;
    }
    
    .popup-data-label {
        font-size: 0.62rem;
    }
    
    .popup-data-value {
        font-size: 0.68rem;
    }
    
    .popup-footer {
        margin-top: 0.3rem;
        padding-top: 0.3rem;
        font-size: 0.58rem;
        line-height: 1.25;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.75rem 1rem;
    }
    
    header h1 {
        font-size: 1.1rem;
    }
}

/* Print Styles */
@media print {
    header {
        position: static;
    }
    
    .controls {
        display: none;
    }
    
    #map {
        height: 100vh;
    }
}

