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

:root {
    --primary-color: #8158c7;
    --primary-dark: #5b21b6;
    --snow-high: #8158c7;
    --snow-medium: #a78bfa;
    --snow-low: #c4b5fd;
    --snow-none: #E0E0E0;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f7fa;
    --card-bg: #fff;
    --border-color: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #8158c7 0%, #a78bfa 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.last-updated {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Map Section */
.map-section {
    margin-bottom: 2rem;
}

#map {
    height: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Region Cards */
.regions-section {
    margin-bottom: 2rem;
}

.regions-section h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.region-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.region-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.region-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.region-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.region-card .snow-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.region-card .stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.region-card .stat {
    font-size: 0.9rem;
    color: var(--text-light);
}

.region-card .stat strong {
    color: var(--text-color);
}

.region-card .best-resort {
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.region-card .best-resort strong {
    color: var(--primary-color);
}

/* Probability bar */
.prob-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.prob-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Resorts Section */
.resorts-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.resorts-section h2 {
    margin-bottom: 1rem;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 150px;
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-color);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #e8ebef;
}

th[data-sort]::after {
    content: ' ↕';
    opacity: 0.3;
}

th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

tbody tr:hover {
    background: var(--bg-color);
}

.snow-chance {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.snow-chance .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.daily-outlook {
    display: flex;
    gap: 4px;
}

.daily-bar {
    width: 20px;
    height: 24px;
    border-radius: 3px;
    position: relative;
    background: var(--snow-none);
}

.daily-bar .fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 3px;
    transition: height 0.3s;
}

.daily-bar:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
}

/* Snow level colors */
.snow-high { background-color: var(--snow-high); }
.snow-medium { background-color: var(--snow-medium); }
.snow-low { background-color: var(--snow-low); }
.snow-none { background-color: var(--snow-none); }

/* Loading state */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.resort-popup h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.resort-popup .popup-stats {
    font-size: 0.9rem;
    color: var(--text-light);
}

.resort-popup .popup-stats strong {
    color: var(--text-color);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1.5rem 1rem;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    #map {
        height: 350px;
    }

    .filters {
        flex-direction: column;
    }

    .filters input,
    .filters select {
        width: 100%;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }
}
