:root {
    --bg-dark: #0f172a;
    --accent-glow: #38bdf8;
    --accent-glow-subtle: rgba(56, 189, 248, 0.2);
    --accent-magenta: #e879f9;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ── Light Mode ─────────────────────────────────────────────────────────── */
:root.light-mode {
    --bg-dark: #f1f5f9;
    --accent-glow: #0284c7;
    --accent-glow-subtle: rgba(2, 132, 199, 0.15);
    --accent-magenta: #c026d3;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(241, 245, 249, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
}

:root.light-mode body {
    background-color: #f1f5f9;
}

:root.light-mode .input-group input {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

:root.light-mode .event-card {
    background: rgba(0, 0, 0, 0.03);
}

:root.light-mode .event-card:hover {
    background: rgba(0, 0, 0, 0.07);
}

:root.light-mode .leaflet-container {
    background: #e2e8f0;
}

:root.light-mode .dark-popup .leaflet-popup-content-wrapper,
:root.light-mode .dark-popup .leaflet-popup-tip {
    background-color: #f8fafc;
    color: #0f172a;
}

:root.light-mode ::-webkit-calendar-picker-indicator {
    filter: none;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    /* Prevent scrolling on the body level */
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Map Container Full Screen behind UI */
#map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Lowest index */
}

#map {
    height: 100%;
    width: 100%;
}

/* Sidebar styling - Glassmorphism floating panel */
#sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    bottom: 20px;
    width: 380px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    z-index: 1000;
    /* Increased to stay above Leaflet layers */
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

header {
    margin-bottom: 24px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

#theme-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

#theme-btn:hover {
    background: rgba(255,255,255,0.15);
}

header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-glow), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus {
    border-color: var(--accent-glow);
    box-shadow: 0 0 0 3px var(--accent-glow-subtle);
    background: rgba(255, 255, 255, 0.1);
}

/* Modifying dark mode date picker indicator */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-header h2 {
    font-size: 18px;
    font-weight: 600;
}

#event-count {
    color: var(--accent-glow);
    font-weight: 800;
}

.event-list {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Scrollbar for event list */
.event-list::-webkit-scrollbar {
    width: 6px;
}

.event-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.event-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.event-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 32px;
    font-style: italic;
}

/* Interactive Event Card */
.event-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.event-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-glow);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.event-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
    border-color: rgba(56, 189, 248, 0.3);
}

.event-card:hover::before {
    transform: scaleY(1);
    transform-origin: top;
}

.event-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.event-category {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.cat-music {
    background: rgba(232, 121, 249, 0.2);
    color: #e879f9;
}

.cat-tech {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.cat-food {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.cat-art {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.event-time,
.event-location {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* Custom Information Window styles for Leaflet Maps popups */
.dark-popup .leaflet-popup-content-wrapper {
    background-color: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
    padding: 2px;
}

.dark-popup .leaflet-popup-tip {
    background-color: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-left: none;
}

.dark-popup a.leaflet-popup-close-button {
    color: var(--text-secondary);
    padding: 8px 12px 0 0;
}

.dark-popup a.leaflet-popup-close-button:hover {
    color: var(--accent-glow);
}

.info-window h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-glow);
}

.info-window p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Leaflet map background fix */
.leaflet-container {
    background: #0f172a;
    font-family: inherit;
}

.custom-leaflet-marker {
    background: transparent;
    border: none;
    filter: drop-shadow(0px 4px 6px rgba(0, 0, 0, 0.5));
}

.custom-leaflet-marker svg {
    display: block;
}

/* ── Sheet Handle (mobile only) ─────────────────────────────────────────── */
.sheet-handle-area {
    display: none;
}

.handle-pill {
    width: 40px;
    height: 4px;
    background: var(--glass-border);
    border-radius: 2px;
    margin: 0 auto 10px;
    flex-shrink: 0;
}

.sheet-mini-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, height 0.2s ease;
    pointer-events: none;
}

.sheet-mini-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-glow), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sheet-mini-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Mobile Bottom Sheet ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sheet-handle-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 12px 0 4px;
        cursor: grab;
        flex-shrink: 0;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
    }

    #sidebar {
        position: fixed;
        width: 100%;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: 72px; /* default: mini state */
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        padding: 0 20px calc(16px + env(safe-area-inset-bottom));
        overflow: hidden;
        transition: height 0.38s cubic-bezier(0.34, 1.1, 0.64, 1);
    }

    /* Mini state: show the mini info bar */
    #sidebar.sheet-mini .sheet-mini-info {
        height: 34px;
        opacity: 1;
        pointer-events: auto;
    }

    /* Inputs side-by-side in peek state to save space */
    .controls {
        flex-direction: row;
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .controls .input-group {
        flex: 1;
    }

    .input-group input {
        padding: 11px 12px;
        font-size: 14px;
        border-radius: 10px;
    }

    header {
        margin-bottom: 16px;
    }

    header h1 {
        font-size: 22px;
    }

    .results-header {
        margin-bottom: 12px;
    }

    /* Event list: native momentum scroll on iOS */
    .event-list {
        -webkit-overflow-scrolling: touch;
    }

    /* Zoom control: top-right stays out of the way */
    .leaflet-top.leaflet-right {
        top: 16px;
    }
}
.event-venue {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.event-map-links {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.map-link {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
}

.map-link:hover { opacity: 0.8; }

.map-link.google {
    background: #4285f4;
    color: #fff;
}

.map-link.apple {
    background: #555;
    color: #fff;
}
