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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #1a1a2e;
    color: #e0e0e0;
}

a {
    color: #5dade2;
    text-decoration: none;
}

a:visited {
    color: #a78bfa;
}

#header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 12px 20px;
    border-bottom: 2px solid #e94560;
    text-align: center;
}

#header h1 {
    font-size: 1.4rem;
    color: #e94560;
    margin-bottom: 2px;
}

#header p {
    font-size: 0.8rem;
    color: #8a8a9a;
}

#header a {
    color: #0f3460;
    color: #5dade2;
}

#controls {
    background: #16213e;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid #2a2a4a;
}

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

.filter-group label {
    font-size: 0.85rem;
    color: #8a8a9a;
    white-space: nowrap;
}

#day-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.day-btn {
    padding: 4px 10px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #b0b0c0;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.day-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.day-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: white;
}

#event-count {
    font-size: 0.85rem;
    color: #8a8a9a;
}

/* Genre filter collapsible */
.genre-toggle-btn {
    padding: 4px 10px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #b0b0c0;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}

.genre-toggle-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.genre-filter-wrap {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.genre-filter-wrap.collapsed {
    display: none;
}

#genre-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.genre-filter-group {
    flex-wrap: wrap;
}

.genre-btn {
    padding: 4px 10px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #b0b0c0;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.genre-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.genre-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: white;
}

.genre-clear {
    font-weight: bold;
}

.event-genre {
    font-size: 0.8rem;
    color: #a0a0c0;
    margin-top: 2px;
}

#map {
    flex: 1;
    z-index: 1;
}

/* Main layout: map + list side by side */
#main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#main-content #map {
    flex: 1;
    min-width: 0;
}

/* List panel */
#list-panel {
    width: 340px;
    background: #16213e;
    border-left: 1px solid #2a2a4a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #2a2a4a;
}

#list-header h2 {
    font-size: 0.95rem;
    color: #e94560;
}

#list-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.list-close-btn {
    display: none;
    padding: 4px 8px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #b0b0c0;
    cursor: pointer;
    font-size: 0.9rem;
}

.list-close-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.list-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    padding: 10px 16px;
    border: none;
    border-radius: 24px;
    background: #e94560;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.list-toggle-btn.hidden {
    display: none !important;
}

#locate-btn {
    padding: 4px 10px;
    border: 1px solid #e94560;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e94560;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
}

#locate-btn:hover {
    background: #e94560;
    color: white;
}

#locate-btn.active {
    background: #e94560;
    color: white;
}

#location-status {
    padding: 0 12px;
    font-size: 0.75rem;
    color: #8a8a9a;
    min-height: 0;
}

#location-status:not(:empty) {
    padding: 6px 12px;
}

#event-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.list-event {
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a4a;
    cursor: pointer;
    transition: background 0.15s;
}

.list-event:hover {
    background: #1a1a2e;
}

.list-event-venue {
    font-size: 0.85rem;
    font-weight: bold;
    color: #e94560;
}

.list-event-venue a {
    color: #e94560;
    text-decoration: none;
}

.list-event-venue a:hover {
    text-decoration: underline;
}

.list-event-distance {
    font-size: 0.7rem;
    color: #5dade2;
    float: right;
    margin-top: 2px;
}

.list-event-band {
    font-size: 0.85rem;
    color: #f0c040;
    margin-top: 2px;
}

.list-event-meta {
    font-size: 0.75rem;
    color: #8a8a9a;
    margin-top: 1px;
}

.list-no-location {
    padding: 20px 12px;
    text-align: center;
    color: #8a8a9a;
    font-size: 0.85rem;
}

.list-hint {
    padding: 6px 12px;
    text-align: center;
    color: #6a6a7a;
    font-size: 0.8rem;
    border-bottom: 1px solid #2a2a4a;
}

.list-divider {
    border: none;
    border-top: 1px solid #3a3a5a;
    margin: 8px 12px;
}

.list-section-label {
    padding: 4px 12px 8px;
    font-size: 0.8rem;
    color: #8a8a9a;
    font-style: italic;
}

.list-event-nocoords {
    opacity: 0.7;
    cursor: default;
}

@media (max-width: 768px) {
    #header {
        padding: 8px 12px;
    }
    #header h1 {
        font-size: 1.1rem;
    }
    #header p {
        font-size: 0.7rem;
    }

    #controls {
        padding: 6px 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .day-btn, .genre-btn, .genre-toggle-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 36px;
    }

    #main-content {
        position: relative;
    }
    #main-content #map {
        flex: 1;
        min-height: 0;
    }

    /* Floating toggle button */
    .list-toggle-btn {
        display: block;
    }

    /* Close button visible on mobile */
    .list-close-btn {
        display: block;
    }

    /* List panel as bottom sheet */
    #list-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-left: none;
        border-top: 2px solid #e94560;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    #list-panel.open {
        transform: translateY(0);
    }

    /* Larger tap targets for list items */
    .list-event {
        padding: 10px 12px;
    }
    .list-event-venue {
        font-size: 0.9rem;
    }
    .list-event-band {
        font-size: 0.9rem;
    }
    .list-event-meta {
        font-size: 0.8rem;
    }

    /* Popup sizing */
    .leaflet-popup-content-wrapper {
        max-width: 280px;
    }
    .leaflet-popup-content {
        max-height: 300px;
        font-size: 0.85rem;
    }
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #3a3a5a;
    border-top: 4px solid #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #e94560;
    border-radius: 8px;
    max-width: 350px;
}

.leaflet-popup-tip {
    background: #1a1a2e;
    border: 1px solid #e94560;
}

.leaflet-popup-content {
    margin: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.venue-popup h3 {
    color: #e94560;
    margin-bottom: 8px;
    font-size: 1rem;
}

.venue-popup h3 a {
    color: #e94560;
    text-decoration: none;
}

.venue-popup h3 a:hover {
    text-decoration: underline;
}

.venue-popup .city {
    color: #8a8a9a;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.event-item {
    padding: 6px 0;
    border-bottom: 1px solid #2a2a4a;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    font-weight: bold;
    color: #5dade2;
    font-size: 0.85rem;
}

.event-day-date {
    color: #8a8a9a;
    font-size: 0.75rem;
}

.event-band {
    font-size: 0.9rem;
    margin: 2px 0;
}

.event-band a {
    color: #f0c040;
    text-decoration: none;
}

.event-band a:hover {
    text-decoration: underline;
}

.event-genre {
    font-size: 0.75rem;
    color: #8a8a9a;
    font-style: italic;
}

.event-info {
    font-size: 0.75rem;
    color: #aaa;
}

.event-link a {
    color: #5dade2;
    text-decoration: none;
    font-size: 0.8rem;
}

.event-link a:hover {
    text-decoration: underline;
}

/* Day color indicators */
.day-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.day-fri { background: #e94560; }
.day-sat { background: #f0c040; }
.day-sun { background: #5dade2; }
.day-mon { background: #2ecc71; }
.day-tue { background: #9b59b6; }
.day-wed { background: #e67e22; }
.day-thu { background: #1abc9c; }

/* Marker cluster customization */
.marker-cluster-small {
    background-color: rgba(233, 69, 96, 0.4);
}
.marker-cluster-small div {
    background-color: rgba(233, 69, 96, 0.8);
}
.marker-cluster-medium {
    background-color: rgba(240, 192, 64, 0.4);
}
.marker-cluster-medium div {
    background-color: rgba(240, 192, 64, 0.8);
}
.marker-cluster-large {
    background-color: rgba(93, 173, 226, 0.4);
}
.marker-cluster-large div {
    background-color: rgba(93, 173, 226, 0.8);
}

/* Extra small screens */
@media (max-width: 600px) {
    #header h1 { font-size: 1rem; }
    .day-btn, .genre-btn, .genre-toggle-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        min-height: 32px;
    }
}
