@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&display=swap');

:root {
    --banner-height: 70px;
    --banner-height-mobile: 60px;
    --control-size: 30px;
    --control-bg: rgba(255, 255, 255, 0.95);
    --control-hover: #f4f4f4;
    --control-active: #e8e8e8;
    --accent-color: #3498db;
    --accent-color-hover: #2980b9;
    --text-main: #1a1a1a;
    --text-muted: #666;
    --shadow-subtle: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.15);
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    overflow: hidden;
}

#map {
    height: calc(100vh - var(--banner-height));
    margin: 0;
    padding: 0;
    position: relative;
}


/* Banner styling */
.top-banner {
    height: var(--banner-height);
    width: 100%;
    background: white;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-subtle);
    z-index: 1003;
    position: relative;
    padding: 0 20px;
    box-sizing: border-box;
}


.banner-container {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.banner-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.banner-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.banner-title {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.banner-subtitle {
    font-size: 0.9rem;
    margin: 2px 0 0 0;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .top-banner {
        height: var(--banner-height-mobile);
        padding: 0 12px;
    }

    .banner-logo {
        height: 40px;
    }

    .banner-title {
        font-size: 1.1rem;
    }

    .banner-subtitle {
        font-size: 0.75rem;
    }

    #map {
        height: calc(100vh - var(--banner-height-mobile));
    }
}


/* Popup styling */
.popup {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
    max-width: 220px;
}

.popup h3 {
    margin: 0 0 6px 0;
    font-size: 1.05em;
}

.popup .meta {
    margin-bottom: 6px;
    font-size: 0.9em;
    color: #444;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    margin-right: 6px;
    vertical-align: middle;
}

.badge.free {
    background: #2ecc71;
    color: white;
}

.badge.paid {
    background: #e74c3c;
    color: white;
}

/* "Now" indicator - recording-style circle */
.badge.now {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffebee;
    color: #c62828;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #ef5350;
    margin-right: 6px;
}

.badge.now::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #ef5350;
    border-radius: 50%;
    animation: pulse-now 1.2s infinite;
    flex-shrink: 0;
}

.badge.now::after {
    content: 'Now';
    font-size: 0.8em;
    font-weight: 600;
}

@keyframes pulse-now {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.25);
    }
}

.popup .time {
    font-size: 0.85em;
    color: #333;
}

.popup .img-wrap {
    margin-bottom: 6px;
}

.popup .img-wrap img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

/* Legend styling */
#legend {
    position: absolute;
    top: calc(var(--banner-height) + 12px);
    right: 12px;
    z-index: 1000;
    background: var(--control-bg);
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto;
    max-width: 220px;
}


#legend h4 {
    margin: 0 0 6px 0;
    font-size: 0.9em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 0.9em;
    color: #222
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.legend-item-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

.legend-item-label .legend-category-name {
    flex: 1;
}

.legend-item-count {
    font-size: 0.8em;
    color: #999;
    margin-left: 6px;
    font-weight: 600;
}

.legend-item {
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.legend-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.legend-item.filtered-out {
    opacity: 0.5;
}

.legend-item.filtered-out .legend-swatch {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(200, 0, 0, 0.3);
}

/* Sidebar event list styling */
#sidebar {
    position: absolute;
    left: -320px;
    top: var(--banner-height);
    bottom: 0;
    width: 320px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, "Helvetica Neue", Arial;
}

#sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 12px 12px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
}

#sidebar-toggle {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: white;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    z-index: 10;
    transition: all 0.2s ease;
    padding-left: 2px;
    color: #333;
}

#sidebar-toggle:hover {
    background: #f8f9fa;
    width: 38px;
    /* Slightly expand on hover */
}

.event-item {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    border-left: 3px solid #3498db;
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-item:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateX(4px);
}

.event-item h4 {
    margin: 0 0 4px 0;
    font-size: 0.95em;
    color: #222;
}

.event-item .time {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 4px;
}

.event-item .category {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    color: white;
    margin-right: 4px;
}

.event-item .badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
    align-items: center;
}

.event-item .badge {
    margin: 0;
    padding: 3px 8px;
}

.event-item.hidden {
    display: none;
}

.event-item-thumb {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    margin-bottom: 8px;
}

.event-link {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 600;
    transition: background 0.2s ease;
}

.event-link:hover {
    background: #2980b9;
}

.popup .event-link {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-weight: 600;
}

/* Live controls collapsible styles */
#live-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto;
    transition: width 0.3s ease;
}

#live-controls.collapsed {
    width: fit-content;
}

#live-controls-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

#live-controls-header:hover {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

#live-controls-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    color: #333;
    padding: 0;
    width: 1.2em;
    text-align: center;
    flex-shrink: 0;
}

#live-controls-content {
    opacity: 1;
    visibility: visible;
}

#current-time-input {
    display: none;
}

#set-now-btn {
    display: none;
}

/* Timeline range slider styles */
#timeline-start,
#timeline-end {
    /* Inputs should not intercept pointer events; we use custom handles */
    pointer-events: none;
}

#timeline-start::-webkit-slider-thumb,
#timeline-end::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    margin-top: 17px;
}

#timeline-start::-moz-range-thumb,
#timeline-end::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    margin-top: 17px;
}

#timeline-start::-moz-range-track,
#timeline-end::-moz-range-track {
    background: transparent;
    border: none;
}

#timeline-ticks {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.75em;
    color: #999;
}

/* Let pointer events pass through the tick layer so the track receives clicks */
#timeline-ticks {
    pointer-events: none;
}

/* But allow labels to be selectable/clickable if needed */
.timeline-tick-label {
    pointer-events: auto;
}

/* Range resize handles (small draggable areas at the ends of the blue range) */
.range-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* larger invisible hit area for easier dragging */
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent; /* invisible hit area */
    cursor: ew-resize;
    z-index: 8;
    pointer-events: auto;
}

/* place handles so their center aligns with the visible edge of the range */
#range-handle-left { left: -14px; }
#range-handle-right { right: -14px; }

/* optional: small visible dot inside the hit area to indicate draggable ends */
.range-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3498db;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
    pointer-events: none;
}

/* Make the visible range dot (handles) the only visible thumb; hide native input thumbs */
#timeline-start::-webkit-slider-thumb,
#timeline-end::-webkit-slider-thumb {
    width: 0;
    height: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

#timeline-start::-moz-range-thumb,
#timeline-end::-moz-range-thumb {
    width: 0;
    height: 0;
    background: transparent;
    border: none;
}

/* ensure range and handles stack above the track */
#timeline-range { z-index: 4; position: absolute; }
.range-handle { z-index: 6; }

/* Increase clickable/touch area around the timeline bar without changing appearance */
#timeline-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    /* extend 12px above and below the visible track */
    top: -12px;
    bottom: -12px;
    background: transparent;
    pointer-events: auto;
    z-index: 3; /* behind the range and handles */
}

.timeline-tick {
    position: absolute; /* positioned by script with left% */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0;
    pointer-events: none; /* ticks should not intercept clicks */
}

.timeline-tick-line {
    width: 2px;
    height: 10px;
    background: #cfcfcf;
    margin-bottom: 6px;
    border-radius: 1px;
}

.timeline-tick-line.date {
    height: 14px;
    background: #6e6e6e;
}

.timeline-tick-line.hour {
    height: 10px;
    background: #9aa4ad;
}

.timeline-tick-label {
    margin-top: 6px;
    font-size: 12px;
    color: #6b6b6b;
    transform: none;
    position: static;
    white-space: nowrap;
    /* Reserve fixed height so labels align even when some are empty */
    min-height: 18px;
    line-height: 18px;
}

@media (max-width: 480px) {
    .timeline-tick-label { font-size: 11px; }
    .timeline-tick-line { height: 8px; }
}

#live-hint {
    display: none;
}

/* Legend collapsible on mobile */
#legend-header {
    display: none;
    cursor: pointer;
    user-select: none;
}

#legend-items {
    max-height: none;
    overflow: visible;
    transition: none;
}

@media (max-width: 768px) {
    #legend {
        width: fit-content;
        top: calc(var(--banner-height-mobile) + 12px);
    }


    #legend h4 {
        display: none;
    }

    #legend-header {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0;
        margin-bottom: 6px;
        cursor: pointer;
        user-select: none;
        font-size: 0.9em;
        font-weight: 600;
        color: #333;
    }

    #legend-toggle {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 0.85em;
        color: #333;
        padding: 0;
        width: 1em;
        text-align: center;
    }

    #legend-items {
        max-height: 300px;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        opacity: 1;
        visibility: visible;
    }

    #legend-items.collapsed {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
    }
}

/* Standard Map Control Buttons */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-geolocation-button {
    width: var(--control-size) !important;
    height: var(--control-size) !important;
    background-color: var(--control-bg) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: background 0.2s ease;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover,
.leaflet-geolocation-button:hover {
    background-color: var(--control-hover) !important;
}

.leaflet-control-zoom-in:active,
.leaflet-control-zoom-out:active,
.leaflet-geolocation-button:active {
    background-color: var(--control-active) !important;
}

/* Geolocation button specific overrides */
.leaflet-geolocation-button {
    border: none;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}


.leaflet-geolocation-button.locating {
    animation: pulse-geo 1s infinite;
}

@keyframes pulse-geo {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}