/* Westside LA Events Aggregator - Enhanced Styles */

/* Self-hosted Inter font - latin-ext subset */
@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/inter/inter-latin-ext.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Self-hosted Inter font - latin subset */
@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/inter/inter-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Golden-hour palette, taken from the logo: warm neutrals, one coral
       accent for actions, warm ink for selection. Values are picked for WCAG
       AA: white on --primary-color is 4.7:1, --primary-dark on the page 5.9:1. */
    --ink: #1c1917;
    --ink-soft: #292524;
    --primary-color: #d93036;
    --primary-dark: #b42329;
    --primary-light: #f0616a;
    --primary-lighter: #ffe1dc;
    --gradient-sunset: linear-gradient(135deg, #7c3aed 0%, #f43f5e 55%, #fb923c 100%);
    --secondary-color: #f97316;
    --secondary-dark: #ea580c;
    --secondary-light: #fb923c;
    --accent-color: #f59e0b;
    --accent-light: #fbbf24;
    --success-color: #10b981;
    --success-light: #34d399;
    --info-color: #0e7490;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* Category Colors - 6 hues at least 29deg apart so the pill dots stay
       distinguishable (indigo sat 19deg from purple and 22deg from blue). */
    --category-purple: #7c3aed;      /* Music, Nightlife */
    --category-pink: #e11d48;        /* Art, Date Night, Theater */
    --category-orange: #ea580c;      /* Food & Drink, Comedy */
    --category-green: #16a34a;       /* Sports, Wellness, Outdoors, Family */
    --category-blue: #2563eb;        /* Community, Education */
    --category-teal: #0891b2;        /* Film, Tech */
    --category-default: #78716c;     /* Other */

    /* Background Colors - Warm Sandy Tones */
    --bg-color: #fbf8f4;
    --bg-secondary: #f4efe8;
    --bg-tertiary: #e9e2d8;
    --card-bg: #ffffff;
    --surface-overlay: rgba(255, 255, 255, 0.95);

    /* Gradient Palettes - Ocean Teal */
    --gradient-primary: var(--ink);
    --gradient-subtle: linear-gradient(135deg, #faf9f7 0%, #fefdfb 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #fdfcfa 100%);

    /* Text Colors */
    --text-color: #1c1917;
    --text-secondary: #44403c;
    --text-light: #6b635b;
    --text-lighter: #78716c;
    --text-muted: #a8a29e;

    /* Typography Scale - Consistent Sizes */
    --text-xs: 0.75rem;    /* 12px - tiny labels, tags */
    --text-sm: 0.875rem;   /* 14px - small body text, captions */
    --text-base: 1rem;     /* 16px - body text */
    --text-md: 1.125rem;   /* 18px - subheads, small headings */
    --text-lg: 1.3rem;     /* 20.8px - section headings, card titles */
    --text-xl: 1.5rem;     /* 24px - page titles */
    --text-2xl: 2rem;      /* 32px - hero titles */
    --text-3xl: 3rem;      /* 48px - main header */

    /* Border & Dividers - Warm Tones */
    --border-color: #e7e0d6;
    --border-light: #efe9e1;
    --border-dark: #cfc6ba;
    --divider-color: rgba(168, 162, 148, 0.2);

    /* Shadows - Neutral and Subtle */
    /* Diffuse, slate-tinted, negative-spread shadows — the airy "glass" look.
       Elevation scale preserved so modals/FABs still read as lifted. */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 6px -2px rgba(15, 23, 42, 0.08);
    --shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.10);
    --shadow-md: 0 8px 20px -8px rgba(15, 23, 42, 0.14);
    --shadow-lg: 0 14px 34px -14px rgba(15, 23, 42, 0.18);
    --shadow-xl: 0 22px 48px -18px rgba(15, 23, 42, 0.24);
    --shadow-2xl: 0 32px 64px -24px rgba(15, 23, 42, 0.30);
    --shadow-colored: 0 6px 18px -8px rgba(217, 48, 54, 0.35);
    --shadow-hover: 0 16px 36px -16px rgba(15, 23, 42, 0.20);

    /* Border Radius */
    --radius-xs: 0.25rem;
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;

    /* Transitions & Animations */
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
}

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

:root {
    /* System serif stack for editorial-feeling headings. No extra font
       fetch — relies on each platform's bundled high-quality serif. */
    --font-display: 'Iowan Old Style', 'Apple Garamond', 'Hoefler Text',
                    'Source Serif Pro', 'Georgia', 'Times New Roman', serif;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.65;
    color: var(--text-color);
    background: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(244, 63, 94, 0.035) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(249, 115, 22, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Two-Column Layout Grid */
.layout-grid {
    display: grid;
    /* Narrower sidebar now that search/date/categories live in the top bar. */
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin: 1.25rem 0 0;
    align-items: start;
}

/* ---------- Hybrid top filter bar ---------- */
.filter-form { display: block; }

.top-filter-bar {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-2xl);
    background: #fff;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 12px 32px -20px rgba(28, 25, 23, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.top-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

/* Search box: a sensible fixed-ish width, never grows to fill the whole bar. */
.top-filter-controls .search-box {
    flex: 0 1 380px;
    min-width: 220px;
    margin-bottom: 0;
}

.top-filter-controls .when-filter {
    flex: 0 0 auto;
}

/* The select label is redundant in the compact top bar. */
.top-filter-controls .when-filter label {
    display: none;
}

/* Size the dropdown to its content instead of stretching. */
.top-filter-controls .when-filter select {
    width: auto;
    min-width: 150px;
}

/* Hide the empty date-picker slot unless a specific date is chosen. */
.top-filter-controls .calendar-filter:empty {
    display: none;
}

/* Push Clear to the far right of the row. */
.top-filter-controls .clear-filters-btn {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
}

/* Time-of-day pill cluster (sits next to the When dropdown). */
.tod-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

/* Crisp white base so they read like the category chips on the frosted bar. */
.top-filter-bar .tod-pill {
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Venues: a "Venues ▾" button opening a checkbox popover. */
.venues-filter {
    position: relative;
    flex: 0 0 auto;
}

.venues-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-color);
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: var(--transition-spring);
}

.venues-toggle:hover {
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.venues-caret {
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

.venues-filter.open .venues-caret { transform: rotate(180deg); }

.venues-popover {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 60;
    width: 280px;
    max-width: 80vw;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.85rem;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
}

.venues-filter.open .venues-popover { display: block; }

/* Venue checkboxes render as full-width list rows inside the popover. */
.venues-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.venues-list .source-checkbox-label {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    border-radius: var(--radius);
}

.venues-empty {
    color: var(--text-light);
    font-size: var(--text-xs);
}

/* Category pills as a single horizontal scroll rail (Netflix/Spotify style):
   compact one line, still fully browsable. A clipped pill at the right edge
   plus the slim scrollbar signal there's more to scroll. */
/* Compact pills wrap into a few tidy lines (smaller pills + no count keep it
   from looking busy). One behavior at all screen sizes. */
.category-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* Subtle lift on the frosted bar; each chip's category dot and selected fill
   are set further down (see --cat). */
.top-filter-bar .category-checkbox-label[data-category] {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Sidebar filters (venues + free/favorites) get their own glass panel. */
@media (min-width: 769px) {
    .sidebar #filter-tallies {
        padding: 1.25rem;
        border-radius: var(--radius-2xl);
        background: rgba(255, 255, 255, 0.72);
        -webkit-backdrop-filter: blur(16px) saturate(150%);
        backdrop-filter: blur(16px) saturate(150%);
        border: 1px solid rgba(255, 255, 255, 0.6);
        box-shadow: 0 8px 30px -16px rgba(15, 23, 42, 0.20);
    }
}

/* Category pills wrap into a few compact lines at all sizes (see base rule). */

/* Left Sidebar - Sticky Filters */
.sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Right Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* Header - hero bar. Richer teal gradient + a soft colored glow and a thin
   gradient accent strip (replaces the hard orange border) to match the
   glass/modern card language. */
/* Slim sticky nav-style header. Deep-teal→ink gradient so the bar reads as
   part of the "California Coast" palette (the wordmark side is coastal teal)
   rather than a neutral admin slate, then settles to ink under the controls
   on the right. Pairs with the warm sandy page below. */
header {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 64px;
    text-align: left;
    flex-wrap: nowrap;
}

/* Global search field in the dark nav bar. */
.header-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 260px;
    max-width: 360px;
    padding: 0 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search:focus-within {
    background: #fff;
    border-color: var(--border-dark);
    box-shadow: 0 0 0 3px rgba(217, 48, 54, 0.12);
}

.header-search-icon {
    display: inline-flex;
    color: var(--text-light);
    flex-shrink: 0;
}

.header-search-icon svg { display: block; }

.header-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: var(--text-sm);
    padding: 0.5rem 0;
}

.header-search input::placeholder {
    color: var(--text-light);
}

/* On phones: hide the counter, let search wrap to its own full-width line. */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 0.6rem 1rem;
    }
    .header-stats {
        display: none;
    }
    .header-search {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
    }
}

.header-wordmark {
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
    font-size: inherit;
}

/* Logo lockup: sunset mark + two-tone wordmark. Shared by header and footer. */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--radius);
}

.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }

.brand:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

.brand-mark {
    display: block;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 9px;
    box-shadow: 0 4px 14px -4px rgba(244, 63, 94, 0.55);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    line-height: 1;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-tag {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--primary-dark);
}

.header-stats {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    color: var(--text-light);
    font-size: var(--text-sm);
    line-height: 1;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
}

.header-stat-num {
    color: var(--text-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.header-stat-label { font-weight: 400; }

.header-stat-sep {
    opacity: 0.45;
    margin: 0 0.15rem;
}

.header-tonight {
    color: white;
    text-decoration: none;
    /* The one coral call to action in the bar. */
    background: var(--primary-color);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--text-sm);
    border: 1px solid transparent;
    box-shadow: 0 4px 12px -4px rgba(217, 48, 54, 0.55);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.header-tonight:hover,
.header-tonight:focus-visible {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px -4px rgba(217, 48, 54, 0.6);
    transform: translateY(-1px);
    outline: none;
}

.header-tonight:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-lighter), 0 0 0 5px var(--primary-color);
}

@media (max-width: 640px) {
    .header-content {
        gap: 0.75rem;
        min-height: 56px;
    }
    /* On phones, drop the stats to give wordmark + Tonight breathing room. */
    .header-stats { display: none; }
    .header-wordmark { font-size: var(--text-base); }
    .header-tonight { padding: 0.35rem 0.7rem; font-size: var(--text-xs); }
}

/* Search Section - Sidebar Design */
.search-section {
    /* True frosted glass: translucent enough that the blur actually reads as
       it floats in the sticky sidebar over the page gradient. */
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    padding: 1.75rem;
    margin: 0;
    border-radius: var(--radius-2xl);
    box-shadow: 0 8px 30px -16px rgba(15, 23, 42, 0.20);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    z-index: 10;
    transition: var(--transition);
}

.search-section:hover {
    box-shadow: 0 12px 36px -16px rgba(217, 48, 54, 0.28);
}

.search-section h2 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-color);
}

.search-box {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    transition: var(--transition);
    background-color: rgba(255, 255, 255, 0.7);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(217, 48, 54, 0.15);
}

.search-box input::placeholder {
    color: var(--text-lighter);
}

.search-box button {
    width: auto;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px -6px rgba(217, 48, 54, 0.6);
    white-space: nowrap;
    flex-shrink: 0;
}

.search-box button:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    box-shadow: 0 6px 18px -6px rgba(217, 48, 54, 0.7);
    transform: translateY(-1px);
}

/* Search button: "Search" text on desktop, compact magnifier icon on mobile
   (the input already searches as you type, so the button stays minimal). */
.search-box button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.search-btn-icon { display: none; }
.search-btn-icon svg { display: block; }
.search-btn-label { display: inline; }

.search-box button:active {
    box-shadow: var(--shadow-sm);
}

.clear-filters-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-bottom: 1rem;
    text-align: left;
    font-family: inherit;
    transition: var(--transition);
    text-decoration: underline;
    text-underline-offset: 2px;
    display: block;
}

.clear-filters-btn:hover {
    color: var(--text-color);
}

/* Filters - Sidebar Design */
.filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: 0.625rem;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    background-color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(217, 48, 54, 0.15);
}

.filter-group select:hover {
    border-color: var(--primary-light);
}

/* Calendar Date Picker Filter */
.calendar-filter {
    display: flex;
    flex-direction: column;
}

.calendar-filter.visible {
    display: flex;
}

.calendar-filter input[type="date"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    background-color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    cursor: pointer;
    font-family: inherit;
}

.calendar-filter input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(217, 48, 54, 0.15);
}

.calendar-filter input[type="date"]:hover {
    border-color: var(--primary-light);
}

/* Style the calendar icon in date input */
.calendar-filter input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
}

.calendar-filter input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Checkbox Filter for Free Events */
.checkbox-filter {
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-color);
    padding: 0.875rem 1.25rem;
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    transition: var(--transition);
    text-transform: none;
    letter-spacing: normal;
    box-shadow: var(--shadow-xs);
}

.checkbox-label:hover {
    border-color: var(--success-light);
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.05) 0%, rgba(52, 211, 153, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.checkbox-label.free-events-checkbox:has(input[type="checkbox"]:checked) {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--success-color);
}

/* Date and Free Events Filters Row */
.filters > .filter-group:not(.category-filter-group):not(.checkbox-filter) {
    display: flex;
    flex-direction: column;
}

/* Filter Presets - Quick access pills */
.filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.preset-pill {
    padding: 0.625rem 1.25rem;
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition-spring);
    box-shadow: var(--shadow-xs);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.preset-pill:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.preset-pill.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-colored);
}

.preset-pill.active:hover {
    box-shadow: var(--shadow-hover);
}

.preset-icon {
    font-size: var(--text-base);
    line-height: 1;
}

/* Primary filters row (Date picker and Free events) */
.filters-primary-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

/* Category Checkboxes Filter Group */
.category-filter-group {
    background: var(--gradient-subtle);
    padding: 1.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.category-filter-group:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filter-header-simple {
    margin-bottom: 0.75rem;
}

/* Collapsible Filter Header */
.filter-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.filter-section-label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    flex: 1;
}

.filter-section-title {
    color: var(--text-color);
}

.filter-count {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-light);
    text-transform: none;
    letter-spacing: normal;
}

/* Collapse Toggle Button */
.collapse-toggle {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    font-size: var(--text-base);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collapse-toggle:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: var(--text-xs);
}

.category-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    transition: all 0.3s ease;
    overflow: hidden;
}

.category-checkbox-label,
.source-checkbox-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-color);
    padding: 0.3rem 0.7rem;
    /* Hairline tinted-glass pill, matching the card category badge. */
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    transition: var(--transition-spring);
    text-transform: none;
    letter-spacing: normal;
    user-select: none;
    box-shadow: none;
}

/* Different styling for source labels */
.source-checkbox-label {
    background-color: white;
}

.category-checkbox-label:hover,
.source-checkbox-label:hover {
    border-color: var(--border-dark);
    background-color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -10px rgba(28, 25, 23, 0.25);
}

/* Keyboard focus ring — the real <input> is visually hidden, so the
   label needs to surface the focus state itself. */
.category-checkbox-label:has(input:focus-visible),
.source-checkbox-label:has(input:focus-visible) {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.category-checkbox-label input[type="checkbox"],
.source-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Leading checkmark — collapsed until selected (no empty box on unselected
   chips). The solid fill below is the primary selection signal. */
.category-checkbox-label::before,
.source-checkbox-label::before {
    content: '\2713';
    font-size: var(--text-xs);
    font-weight: 900;
    width: 0;
    margin-right: -0.4rem;
    opacity: 0;
    overflow: hidden;
    transition: var(--transition);
}

.category-checkbox-label:has(input[type="checkbox"]:checked),
.source-checkbox-label:has(input[type="checkbox"]:checked) {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
    box-shadow: 0 4px 14px -6px rgba(28, 25, 23, 0.45);
    font-weight: 600;
}

.category-checkbox-label:has(input[type="checkbox"]:checked)::before,
.source-checkbox-label:has(input[type="checkbox"]:checked)::before {
    width: 0.8rem;
    margin-right: 0;
    opacity: 1;
}

/* Free leads the pill row but is a price filter, not a category: a small
   gap sets it apart, and it wears the same green as the FREE card badge. */
.category-checkbox-label.free-pill {
    --cat: #16a34a;
    margin-right: 0.4rem;
}

/* Category pills: calm white chips carrying a small dot in the category color.
   Selected pills turn ink (shared rule above) and keep their dot, so the
   color coding survives without a row of competing fills. */
.category-checkbox-label[data-category] { --cat: var(--category-default); }
.category-checkbox-label[data-category="Music"],
.category-checkbox-label[data-category="Nightlife"] { --cat: var(--category-purple); }
.category-checkbox-label[data-category="Art"],
.category-checkbox-label[data-category="Theater"],
.category-checkbox-label[data-category="Date Night"] { --cat: var(--category-pink); }
.category-checkbox-label[data-category="Food & Drink"],
.category-checkbox-label[data-category="Comedy"] { --cat: var(--category-orange); }
.category-checkbox-label[data-category="Sports"],
.category-checkbox-label[data-category="Wellness"],
.category-checkbox-label[data-category="Outdoors"],
.category-checkbox-label[data-category="Family"] { --cat: var(--category-green); }
.category-checkbox-label[data-category="Community"],
.category-checkbox-label[data-category="Education"] { --cat: var(--category-blue); }
.category-checkbox-label[data-category="Film"],
.category-checkbox-label[data-category="Tech"] { --cat: var(--category-teal); }

.category-checkbox-label[data-category],
.category-checkbox-label.free-pill {
    background: #fff;
    border-color: var(--border-color);
}

.category-checkbox-label[data-category]::before,
.category-checkbox-label.free-pill::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.1rem;
    border-radius: 50%;
    background: var(--cat);
    opacity: 1;
}

/* Keep the dot round when selected (the shared checked rule widens ::before
   for the checkmark used by the time-of-day and venue pills). */
.category-checkbox-label[data-category]:has(input[type="checkbox"]:checked)::before,
.category-checkbox-label.free-pill:has(input[type="checkbox"]:checked)::before {
    width: 0.5rem;
    margin-right: 0.1rem;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.category-checkbox-label[data-category]:hover,
.category-checkbox-label.free-pill:hover {
    border-color: color-mix(in srgb, var(--cat) 55%, var(--border-color));
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.category-tag {
    padding: 0.625rem 1.25rem;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 2rem;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.category-tag:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.category-tag.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow);
}

/* View Toggle - Segmented Control Style */
.view-toggle {
    display: inline-flex;
    gap: 0.25rem;
    margin: 0;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
}

.view-toggle button {
    padding: 0.875rem 2rem;
    background-color: transparent;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    color: var(--text-light);
    font-size: var(--text-base);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.view-toggle button:hover:not(.active) {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.5);
}

.view-toggle button.active {
    background: white;
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(28, 25, 23, 0.12);
}

/* Icon inside each view-toggle button. */
.view-btn-icon {
    display: inline-flex;
}

.view-btn-icon svg { display: block; }

/* Desktop: the toggle lives in the top filter bar's controls row, so make it
   compact enough to sit on a line with the When dropdown and pills. Scoped to
   min-width:769px so the mobile fixed-bottom segmented control (max-width:768px)
   is untouched — a bare .view-toggle override would out-specificity it. */
@media (min-width: 769px) {
    .top-filter-controls .view-toggle {
        margin: 0;
        padding: 0.2rem;
        border-radius: var(--radius-lg);
    }
    .top-filter-controls .view-toggle button {
        padding: 0.4rem 0.85rem;
        font-size: var(--text-sm);
    }
}

/* Map Container */
#map {
    width: 100%;
    height: 600px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin: 1rem 0;
    overflow: hidden;
}

.results-header {
    margin: 0.5rem 0 1rem;
    color: var(--text-light);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Events Grid - Enhanced Cards */
#events-container {
    padding: 0;
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 0 0 4rem;
}

.event-card {
    border-radius: var(--radius-2xl);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Hairline + soft warm shadow; the photo carries the color. */
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04),
                0 10px 28px -18px rgba(28, 25, 23, 0.22);
}

/* Glass look drops the old top category bar (category now lives in the badge). */
.event-card::before { content: none; }

.event-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color);
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05),
                0 22px 44px -20px rgba(28, 25, 23, 0.32);
}

/* Category-Specific Card Accents - Consolidated Colors */
.event-card[data-category="Music"]::before,
.event-card[data-category="Nightlife"]::before,
.event-card[data-category="entertainment"]::before {
    background: var(--category-purple);
}

.event-card[data-category="Art"]::before,
.event-card[data-category="Art Shows & Galleries"]::before,
.event-card[data-category="Date Night"]::before,
.event-card[data-category="Theater"]::before,
.event-card[data-category="Theatre"]::before {
    background: var(--category-pink);
}

.event-card[data-category="Food & Drink"]::before,
.event-card[data-category="Food"]::before,
.event-card[data-category="Comedy"]::before {
    background: var(--category-orange);
}

.event-card[data-category="Sports"]::before,
.event-card[data-category="Wellness"]::before,
.event-card[data-category="Outdoors"]::before,
.event-card[data-category="Family"]::before,
.event-card[data-category="Free"]::before {
    background: var(--category-green);
}

.event-card[data-category="Community"]::before,
.event-card[data-category="Education"]::before,
.event-card[data-category="Educational"]::before,
.event-card[data-category="Bookstore Events"]::before {
    background: var(--category-blue);
}

.event-card[data-category="Film"]::before,
.event-card[data-category="Tech"]::before {
    background: var(--category-teal);
}

/* Card media wrapper — anchors the date chip overlay over the event image.
   overflow:hidden clips the hover zoom so it never bleeds into the content. */
.event-card-media {
    position: relative;
    display: block;
    line-height: 0;
    overflow: hidden;
}

/* Only the image-link wrapper should fill the wrapper as a block. The
   date chip is excluded so it can keep its inline-flex stacked layout. */
.event-card-media > a:not(.event-date-chip) {
    display: block;
}

/* Subtle top scrim so frosted chips stay legible over bright photos. */
.event-card-media::after {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 45%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

/* Slow zoom on hover for a premium, tactile feel. */
.event-image,
.event-image-placeholder {
    transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.event-card:hover .event-image,
.event-card:hover .event-image-placeholder {
    transform: scale(1.05);
}

/* Date chip — top-left pill on the image. Rendered as an <a> when an
   event has an id so a tap downloads the .ics; the visual is identical
   to the decorative variant for events without ids. */
.event-date-chip {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.375rem 0.5rem;
    /* Solid calendar tile: reads on any photo (the frosted version went
       muddy grey over dark images). */
    background: #fff;
    color: var(--text-color);
    border-radius: 0.75rem;
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.35);
    font-family: inherit;
    line-height: 1.1;
    text-decoration: none;
}

a.event-date-chip {
    cursor: pointer;
}

a.event-date-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.event-date-chip-dow {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
}

.event-date-chip-day {
    font-size: var(--text-md);
    font-weight: 800;
    color: var(--text-color);
}

.event-date-chip-mon {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

/* Start time, below the date, with a hairline divider. */
.event-date-chip-time {
    margin-top: 0.2rem;
    padding-top: 0.2rem;
    width: 100%;
    text-align: center;
    border-top: 1px solid var(--border-light);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Multi-day range variant: two stacked dates with a thin divider between.
   Reads better than the previous compressed arrow form. */
.event-date-chip-range {
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.375rem 0.625rem;
    min-width: 3.25rem;
}

.event-date-chip-range-line {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.event-date-chip-range-line + .event-date-chip-range-line {
    border-top: 1px solid var(--border-light);
    padding-top: 0.125rem;
    margin-top: 0.125rem;
}

.event-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #0891b2 0%, #f97316 100%);
    position: relative;
}

/* Category-colored placeholder when no event image */
.event-image-placeholder {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    position: relative;
    overflow: hidden;
}

.event-image-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.03) 0px,
        rgba(255,255,255,0.03) 1px,
        transparent 1px,
        transparent 12px
    );
}

.event-image-placeholder[data-category="Music"],
.event-image-placeholder[data-category="Nightlife"] {
    background: linear-gradient(135deg, #3b0764 0%, #7c3aed 100%);
}

.event-image-placeholder[data-category="Art"],
.event-image-placeholder[data-category="Theater"],
.event-image-placeholder[data-category="Theatre"],
.event-image-placeholder[data-category="Date Night"] {
    background: linear-gradient(135deg, #880e4f 0%, #e11d48 100%);
}

.event-image-placeholder[data-category="Food & Drink"],
.event-image-placeholder[data-category="Food"],
.event-image-placeholder[data-category="Comedy"] {
    background: linear-gradient(135deg, #7c2d12 0%, #ea580c 100%);
}

.event-image-placeholder[data-category="Sports"],
.event-image-placeholder[data-category="Wellness"],
.event-image-placeholder[data-category="Outdoors"],
.event-image-placeholder[data-category="Family"] {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
}

.event-image-placeholder[data-category="Community"],
.event-image-placeholder[data-category="Education"] {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

.event-image-placeholder[data-category="Film"],
.event-image-placeholder[data-category="Tech"] {
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 100%);
}

.placeholder-label {
    position: relative;
    z-index: 1;
    font-size: var(--text-sm);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    padding: 0 1rem;
}

.event-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
}

.event-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Event Header with Title and Price */
.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.event-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.2;
    letter-spacing: -0.005em;
    flex: 1;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Date bucket headers — editorial section breaks above the events grid. */
.date-group {
    margin-bottom: 2rem;
}

.date-group-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0.5rem 0 1rem;
}

/* Sunset hairline trailing each date heading, echoing the logo. */
.date-group-title::after {
    content: '';
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.35), rgba(244, 63, 94, 0.4) 18%, rgba(251, 146, 60, 0.2) 40%, transparent);
}

.event-header .event-title {
    margin-bottom: 0;
}

/* Price chip — inline metadata weight (FREE and $25 look identical;
   the chip is one consistent 'how much' signal, not a feature badge). */
.event-price {
    padding: 0.1rem 0.5rem;
    border-radius: 0.375rem;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-light);
    line-height: 1.4;
}

.event-price.free-badge {
    background: #ecfdf3;
    color: #067647;
    border-color: #abefc6;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.price-note {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
    font-size: var(--text-xs);
}

.date-night-badge {
    background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
    color: white;
    border-color: #e11d48;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* Single metadata row: time + venue. Replaces the older .event-date and
   .event-location stacks. The chip on the image owns the date display;
   this row earns its space by adding time-of-day and a clickable venue. */
.event-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
    color: var(--text-light);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.event-meta-time {
    color: var(--text-color);
    font-weight: 600;
}

.event-meta-sep {
    color: var(--text-lighter);
    user-select: none;
}

.event-meta-row .venue-location-link {
    color: var(--text-light);
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.125rem 0.25rem;
    margin: -0.125rem -0.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

/* No underline on hover — that was making the whole venue/address pair
   read like a verbose hyperlink. Instead use a subtle background lift
   and tint only the venue name. */
.event-meta-row .venue-location-link:hover,
.event-meta-row .venue-location-link:focus-visible {
    background: var(--bg-secondary);
    text-decoration: none;
}

.event-meta-row .venue-location-link:hover .event-meta-venue,
.event-meta-row .venue-location-link:focus-visible .event-meta-venue {
    color: var(--primary-color);
}

.event-meta-row .venue-location-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.event-meta-pin {
    display: inline-flex;
    align-items: center;
    margin-right: 0.25rem;
    margin-top: 0.1rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.event-meta-pin svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* Venue (primary) + address (secondary) stacked inside a single link. */
.event-meta-place {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.event-meta-venue {
    color: var(--text-color);
    font-weight: 600;
}

.event-meta-address {
    color: var(--text-light);
    font-weight: 400;
    font-size: var(--text-xs);
    margin-top: 0.1rem;
}

.event-meta-row {
    align-items: flex-start;
}

.event-description {
    color: var(--text-light);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Link wrapper for event description - maintains styling while making clickable */
.event-content > a {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
}

.event-content > a:hover .event-description {
    color: var(--accent-color);
    transition: color 0.2s ease;
}

.event-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    gap: 0.75rem;
}

.event-category {
    --cat: var(--category-default);
    padding: 0.3rem 0.85rem;
    /* Soft tinted-glass chip: category color carried at low intensity so it
       complements the title instead of shouting over it. */
    background: color-mix(in srgb, var(--cat) 14%, white);
    color: color-mix(in srgb, var(--cat) 82%, black);
    border: 1px solid color-mix(in srgb, var(--cat) 28%, transparent);
    border-radius: 2rem;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: inline-block;
}

.event-category-filter {
    cursor: pointer;
    transition: var(--transition);
}

.event-category-filter:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: var(--shadow-md);
    opacity: 0.9;
}

/* Category-specific accent color (drives the tinted-glass badge above). */
.event-category[data-category="Music"],
.event-category[data-category="Nightlife"],
.event-category[data-category="entertainment"] {
    --cat: var(--category-purple);
}

.event-category[data-category="Art"],
.event-category[data-category="Art Shows & Galleries"],
.event-category[data-category="Date Night"],
.event-category[data-category="Theater"],
.event-category[data-category="Theatre"] {
    --cat: var(--category-pink);
}

.event-category[data-category="Food & Drink"],
.event-category[data-category="Food"],
.event-category[data-category="Comedy"] {
    --cat: var(--category-orange);
}

.event-category[data-category="Sports"],
.event-category[data-category="Wellness"],
.event-category[data-category="Outdoors"],
.event-category[data-category="Family"],
.event-category[data-category="Free"] {
    --cat: var(--category-green);
}

.event-category[data-category="Community"],
.event-category[data-category="Education"],
.event-category[data-category="Educational"],
.event-category[data-category="Bookstore Events"] {
    --cat: var(--category-blue);
}

.event-category[data-category="Film"],
.event-category[data-category="Tech"] {
    --cat: var(--category-teal);
}

.event-category[data-category="Other"] {
    --cat: var(--category-default);
}

.event-source-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: var(--transition);
    /* Touch target size: ensure adequate touch area */
    min-height: 44px;
    padding: 0.5rem;
}

.event-source-link:hover {
    transform: scale(1.05);
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.event-source-link .source-logo {
    opacity: 0.7;
}

.event-source-link:hover .source-logo {
    opacity: 1;
}

.source-logo {
    height: 24px;
    max-height: 24px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    opacity: 0.85;
    transition: var(--transition);
}

.source-logo:hover {
    opacity: 1;
}

/* Larger source logo for event detail page */
.event-detail-info .source-logo {
    height: 64px;
    max-width: 200px;
}

.event-source {
    color: var(--text-lighter);
    font-size: var(--text-xs);
    font-weight: 600;
}

.source-label {
    color: var(--text-light);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* Loading State - Enhanced Spinner */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-light);
}

.loading::before {
    content: '';
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-right-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

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

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.htmx-request {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Empty State - Friendly Message */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.empty-state p {
    font-size: var(--text-base);
    max-width: 400px;
    margin: 0 auto;
}

.empty-state .empty-hint {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* Event Detail Page styles removed - events now link directly to source */

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-light);
    position: relative;
}

footer p {
    margin: 0.5rem 0;
}

footer .footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

footer .footer-credit a { color: var(--primary-dark); }

footer .footer-sources {
    max-width: 34rem;
    margin-left: auto;
    margin-right: auto;
    font-size: var(--text-sm);
    color: var(--text-light);
}

footer .footer-credit {
    font-size: var(--text-sm);
    margin-top: 1rem;
    color: var(--text-lighter);
}

footer .footer-credit a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

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

footer .footer-photo-credit {
    font-size: var(--text-xs);
    color: var(--text-lighter);
    margin-top: 0.75rem;
}

footer .footer-photo-credit a {
    color: var(--text-light);
    text-decoration: none;
}

footer .footer-photo-credit a:hover {
    text-decoration: underline;
}

/* Responsive Design - Mobile First Improvements */

/* Tablet and below: Stack sidebar */
@media (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
        height: auto;
        max-height: none;
        overflow-y: visible;
    }

    .search-section {
        padding: 1.5rem;
        margin: 0;
    }
}

/* Desktop with narrower sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    .layout-grid {
        grid-template-columns: 280px 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: sticky;
        top: 10px;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    /* Better touch targets for mobile */
    * {
        -webkit-tap-highlight-color: rgba(217, 48, 54, 0.1);
    }

    .header-title-row {
        gap: 0.75rem;
    }

    .header-logo-left {
        font-size: 2.5rem;
    }

    .header-logo-right {
        height: 2.5rem !important;
        max-height: 2.5rem;
        max-width: 2.5rem;
    }

    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
        letter-spacing: -0.02em;
    }

    .header-subtitle {
        font-size: var(--text-base);
        padding: 0 1rem;
        line-height: 1.5;
    }

    header {
        padding: 0.6rem 0 0.75rem;
    }

    .container {
        padding: 0 1rem;
    }

    .search-section {
        padding: 1.5rem;
        margin: -2rem 0.5rem 1.5rem;
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
    }

    .search-section h2 {
        font-size: var(--text-lg);
    }

    /* Keep search + a compact magnifier icon on one row (no full-width button). */
    .search-box {
        flex-direction: row;
        gap: 0.5rem;
    }

    .search-box input {
        flex: 1;
        min-width: 0;
        padding: 0.75rem 0.9rem;
        font-size: var(--text-base);
    }

    .search-box button {
        width: auto;
        padding: 0 0.9rem;
    }

    .search-btn-label { display: none; }
    .search-btn-icon { display: inline-flex; }

    .search-box::before {
        display: none;
    }

    .layout-grid {
        padding: 0;
    }

    .filters {
        gap: 1rem;
    }

    .filters-primary-row {
        gap: 0.75rem;
    }

    .checkbox-label {
        padding: 0.875rem 1rem;
        font-size: var(--text-sm);
    }

    .category-filter-group {
        padding: 1rem;
    }

    .category-checkboxes {
        gap: 0.5rem;
    }

    .category-checkbox-label,
    .source-checkbox-label {
        padding: 0.625rem 0.875rem;
        font-size: var(--text-sm);
        min-height: 44px;  /* WCAG AA / iOS HIG tap target */
    }

    .category-checkbox-label::before,
    .source-checkbox-label::before {
        width: 0.875rem;
        height: 0.875rem;
    }

    .category-checkbox-label::after,
    .source-checkbox-label::after {
        left: 1rem;
        font-size: var(--text-xs);
    }

    .calendar-filter input[type="date"] {
        padding: 0.875rem 1rem;
        font-size: var(--text-base);
    }

    .events-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 0 0 3rem;
    }

    .event-card {
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-sm);
    }

    .event-card:active {
        transform: scale(0.98);
    }

    .event-title {
        font-size: var(--text-lg);
        line-height: 1.35;
    }

    .event-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .event-price {
        align-self: flex-start;
        padding: 0.4rem 0.875rem;
        font-size: var(--text-xs);
    }

    .event-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .event-link,
    .calendar-link {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }

    #map {
        height: 350px;
        border-radius: var(--radius-lg);
    }

    /* Bottom-anchored segmented control: one-handed reach on iPhones.
       Centered so it doesn't collide with the bottom-right Filter FAB. */
    .view-toggle {
        position: fixed;
        bottom: calc(1.25rem + env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        background: var(--surface-overlay);
        -webkit-backdrop-filter: saturate(180%) blur(12px);
        backdrop-filter: saturate(180%) blur(12px);
        width: auto;
        max-width: 70vw;
        padding: 0.25rem;
        border-radius: var(--radius-full);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border-light);
        justify-content: stretch;
        margin: 0;
    }

    .view-toggle button {
        flex: 1;
        padding: 0.625rem 1.125rem;
        min-height: 40px;
    }

    /* Leave room under the last card for the floating view toggle + FAB. */
    .main-content {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }

    .event-detail-image {
        height: 250px;
        border-radius: var(--radius-lg);
        margin-bottom: 1.5rem;
        border: 2px solid white;
    }

    .event-detail-title {
        font-size: 1.75rem;
    }

    .section-heading {
        font-size: var(--text-lg);
        margin-bottom: 1rem;
    }

    .event-detail-card {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .event-detail-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1.25rem;
    }

    .event-detail-info {
        padding: 1.25rem;
    }

    .event-detail-info Strong {
        min-width: 80px;
        font-size: var(--text-xs);
    }

    .event-detail-description {
        font-size: var(--text-base);
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
        padding: 0.875rem 1.5rem;
    }

    .event-detail-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .event-detail-card #event-map {
        height: 300px;
        border-radius: var(--radius);
    }
}

/* Tablet Optimization */
@media (min-width: 481px) and (max-width: 768px) {
    .events-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }

    .search-section {
        margin: -2rem 1rem 1.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .events-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* HTMX Loading Indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: block !important;
}

.htmx-request.htmx-indicator {
    display: block !important;
}

/* Spinner Animation */
.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-right-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: var(--shadow-sm);
}

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

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: fadeIn 0.4s ease-out forwards;
}

.event-card:nth-child(1) { animation-delay: 0.05s; }
.event-card:nth-child(2) { animation-delay: 0.1s; }
.event-card:nth-child(3) { animation-delay: 0.15s; }
.event-card:nth-child(4) { animation-delay: 0.2s; }
.event-card:nth-child(5) { animation-delay: 0.25s; }
.event-card:nth-child(6) { animation-delay: 0.3s; }

/* Skeleton Loading Screens */
.skeleton-card {
    background: var(--gradient-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: relative;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-title {
    height: 1.5rem;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
    width: 80%;
}

.skeleton-text {
    height: 1rem;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 75%;
}

.skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 0.75rem;
}

.skeleton-badge {
    height: 1.75rem;
    width: 5rem;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-full);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    transition: var(--transition);
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out forwards;
}

.toast-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
    line-height: 1;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toast-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-color);
    line-height: 1.3;
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-light);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-lighter);
    font-size: var(--text-lg);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
    /* Touch target size: WCAG AAA minimum 44x44px */
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--text-color);
}

/* Toast Types */
.toast.success {
    border-left-color: var(--success-color);
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

/* Toast Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Mobile toast positioning */
@media (max-width: 768px) {
    #toast-container {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: 0;
        max-width: 100%;
    }

    @keyframes slideInRight {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes slideOutRight {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100%);
            opacity: 0;
        }
    }
}

.loading-content {
    text-align: center;
}

/* Show loading indicator during HTMX requests */
#loading-indicator.htmx-request {
    display: block !important;
}

/* Favorite Button Styles */
.favorite-btn {
    background: transparent;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: var(--transition);
    color: var(--text-lighter);
    margin-left: 0.5rem;
    /* Touch target size: WCAG AAA minimum 44x44px */
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.favorite-btn.favorited {
    color: var(--secondary-color);
    animation: heartbeat 0.3s ease-in-out;
}

.favorite-btn.favorited:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 2px 8px rgba(217, 48, 54, 0.4));
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Event header layout adjustment for favorite button */
.event-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.event-title-wrapper {
    flex: 1;
    min-width: 0;
}

/* Favorites checkbox styling */
.favorites-checkbox {
    margin-top: 0.5rem;
}

.favorites-checkbox label {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Venue Map Popup Modal */
.venue-map-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.venue-map-modal-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.venue-map-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
}

.venue-map-modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--text-color);
}

.venue-map-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    /* Touch target size: WCAG AAA minimum 44x44px */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.venue-map-close:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.venue-map-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.venue-map-modal-footer p {
    margin: 0;
    color: var(--text-light);
    font-size: var(--text-sm);
}

.venue-map-modal-footer .btn-primary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.venue-map-modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .venue-map-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    #venue-popup-map {
        height: 300px !important;
    }

    .venue-map-modal-header,
    .venue-map-modal-footer {
        padding: 1rem;
    }

    .venue-map-modal-footer {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    #venue-map-directions-btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ========================================
   MOBILE BOTTOM SHEET FILTER DRAWER
   ======================================== */

/* Desktop: Hide mobile-only components */
.filter-fab,
.bottom-sheet-overlay,
.bottom-sheet-handle,
.bottom-sheet-header {
    display: none;
}

/* Mobile: Bottom sheet filter drawer */
@media (max-width: 768px) {
    /* Convert sidebar to fixed bottom sheet */
    .sidebar {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto !important;
        z-index: 9999;
        max-height: 85vh;
        height: auto !important;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        background: white;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 0 1.5rem;
        margin: 0 !important;
    }

    .sidebar.sheet-open {
        transform: translateY(0);
    }

    /* Show bottom sheet header on mobile */
    .bottom-sheet-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-dark);
        border-radius: var(--radius-full);
        margin: 0.75rem auto 0;
        flex-shrink: 0;
    }

    .bottom-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1.5rem 0.25rem;
        flex-shrink: 0;
    }

    .bottom-sheet-title {
        font-size: var(--text-md);
        font-weight: 700;
        color: var(--text-color);
    }

    .bottom-sheet-close {
        background: none;
        border: none;
        font-size: var(--text-xl);
        color: var(--text-light);
        cursor: pointer;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-full);
        transition: var(--transition);
    }

    .bottom-sheet-close:hover,
    .bottom-sheet-close:active {
        background: var(--bg-secondary);
        color: var(--text-color);
    }

    /* Show FAB */
    .filter-fab {
        display: flex;
        position: fixed;
        bottom: calc(1.5rem + env(safe-area-inset-bottom));
        right: calc(1.5rem + env(safe-area-inset-right));
        z-index: 1000;
        background: var(--gradient-primary);
        color: white;
        border: none;
        border-radius: var(--radius-full);
        padding: 1rem 1.5rem;
        font-size: var(--text-base);
        font-weight: 700;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
        align-items: center;
        gap: 0.5rem;
        transition: var(--transition);
        font-family: inherit;
    }

    .filter-fab:hover,
    .filter-fab:active {
        transform: scale(1.05);
        box-shadow: var(--shadow-xl);
    }

    .filter-fab-icon {
        font-size: var(--text-lg);
    }

    /* Hide FAB when sheet is open */
    .filter-fab.hidden {
        transform: scale(0);
        opacity: 0;
        pointer-events: none;
    }

    /* Show overlay */
    .bottom-sheet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .bottom-sheet-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Prevent body scroll when sheet is open */
    body.bottom-sheet-open {
        overflow: hidden;
    }

    /* Adjust search section inside bottom sheet */
    .sidebar .search-section {
        margin: 0 !important;
        border-radius: 0;
        box-shadow: none;
        border: none;
        padding: 1rem 1.5rem 1.5rem;
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    display: none;
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    left: calc(1.5rem + env(safe-area-inset-left));
    z-index: 999;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    width: 44px;
    height: 44px;
    font-size: var(--text-lg);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    display: flex;
}

.scroll-to-top:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 5.5rem;
        left: 1rem;
    }
}

/* Accessibility: Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Region tabs (Westside / Beyond the Westside)
   ========================================================================== */

.region-tabs {
    display: flex;
    gap: 0.25rem;
    width: fit-content;
    max-width: 100%;
    margin: 1.25rem 0 0;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    /* Narrow screens get a horizontal scroll rather than a wrapped, ragged
       tab strip. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.region-tab {
    flex: 0 0 auto;
    padding: 0.5rem 1.1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    border-radius: calc(var(--radius-lg) - 0.2rem);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.region-tab:hover {
    color: var(--text-color);
}

.region-tab.active {
    background: var(--ink);
    color: #fff;
    box-shadow: 0 2px 8px -3px rgba(28, 25, 23, 0.45);
}

.region-tab:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Home hero: sunset banner with the pitch, live counts and quick filters
   ========================================================================== */

.home-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 1.5rem;
    padding: 2.25rem 2.5rem;
    min-height: 220px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    color: white;
    /* Ink wash on the left keeps the copy legible over the bright sun. */
    background:
        linear-gradient(90deg, rgba(38, 18, 44, 0.74) 0%, rgba(38, 18, 44, 0.38) 45%, rgba(38, 18, 44, 0) 72%, rgba(38, 18, 44, 0.28) 100%),
        url('/static/images/hero-beach.jpg') center 40% / cover no-repeat,
        #3b1d3f;
    box-shadow: 0 18px 40px -24px rgba(124, 45, 80, 0.55);
}

.hero-copy {
    max-width: 38rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 1.1rem + 2vw, 2.6rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin: 0 0 0.6rem;
    text-wrap: balance;
}

.hero-subtitle {
    font-size: var(--text-base);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 1.25rem;
    max-width: 32rem;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-chip {
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hero-chip:hover {
    background: #fff;
    border-color: #fff;
    color: var(--text-color);
    transform: translateY(-1px);
}

.hero-chip:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.hero-stats {
    display: flex;
    gap: 1.75rem;
    flex-shrink: 0;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

.hero-stat-num {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.hero-stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

@media (max-width: 900px) {
    .home-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        background:
            linear-gradient(180deg, rgba(38, 18, 44, 0.35) 0%, rgba(38, 18, 44, 0.8) 100%),
            url('/static/images/hero-beach.jpg') 45% 40% / cover no-repeat,
            #3b1d3f;
    }
    .hero-stat { align-items: flex-start; }
}

/* ==========================================================================
   Phones: keep the filter panel short so events show above the fold
   ========================================================================== */

@media (max-width: 640px) {
    .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
    .brand-name { font-size: 1.1rem; }
    .brand-tag { font-size: 0.55rem; }

    .home-hero {
        margin-top: 1rem;
        padding: 1.25rem 1.1rem;
        min-height: 0;
        gap: 0.9rem;
    }
    .hero-title { margin-bottom: 0.8rem; }
    .hero-subtitle { display: none; }
    .hero-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -1.1rem;
        padding: 0 1.1rem;
    }
    .hero-chips::-webkit-scrollbar { display: none; }
    .hero-chip { flex: 0 0 auto; padding: 0.4rem 0.8rem; font-size: var(--text-xs); white-space: nowrap; }
    .hero-stats { gap: 1.25rem; }
    .hero-stat-num { font-size: 1.3rem; }
    .hero-stat-label { font-size: 0.6rem; }
}

@media (max-width: 768px) {
    .region-tabs { margin-top: 1rem; }

    .top-filter-bar {
        margin-top: 0.75rem;
        padding: 0.85rem;
        gap: 0.7rem;
        /* backdrop-filter makes this panel the containing block for the
           position:fixed List/Map toggle inside it, pinning the "floating"
           toggle over the pills instead of the viewport bottom. */
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: #fff;
    }

    /* Row 1: When + Venues + Clear. Row 2: time-of-day rail. */
    .top-filter-controls { gap: 0.6rem; }
    .top-filter-controls .when-filter { flex: 1 1 auto; }
    .top-filter-controls .when-filter select { width: 100%; min-width: 0; }
    .top-filter-controls .clear-filters-btn { margin: 0; }
    .tod-group { order: 5; flex: 1 1 100%; }

    /* Pills become single-line, swipeable rails bleeding to the panel edge,
       instead of wrapping into five rows that push every event off-screen. */
    .tod-group,
    .category-filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        /* overflow-x:auto clips vertically too; the block padding keeps the
           focus ring and hover lift visible. The end padding lets the last
           pill scroll clear of the edge fade. */
        margin: -0.25rem -0.85rem;
        padding: 0.25rem 2.5rem 0.25rem 0.85rem;
        scroll-padding-left: 0.85rem;
        /* Fade the right edge to signal there's more to swipe. */
        -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
        mask-image: linear-gradient(90deg, #000 88%, transparent);
    }
    .tod-group::-webkit-scrollbar,
    .category-filter-bar::-webkit-scrollbar { display: none; }

    .category-filter-bar { padding-top: 0.95rem; margin-top: 0; }

    .tod-group .category-checkbox-label,
    .category-filter-bar .category-checkbox-label {
        flex: 0 0 auto;
        white-space: nowrap;
        min-height: 44px;  /* WCAG AA / iOS HIG tap target, as above */
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }
}

/* Map marker clusters in the site palette (Leaflet's default is
   green/yellow/orange). Outer ring = soft halo, inner disc = fill. */
.marker-cluster-small { background-color: rgba(251, 146, 60, 0.35); }
.marker-cluster-small div { background-color: #fb923c; }
.marker-cluster-medium { background-color: rgba(244, 63, 94, 0.32); }
.marker-cluster-medium div { background-color: #f43f5e; }
.marker-cluster-large { background-color: rgba(124, 58, 237, 0.3); }
.marker-cluster-large div { background-color: #7c3aed; }
.marker-cluster div {
    color: #fff;
    font-weight: 700;
    font-family: inherit;
}

/* Event map pin (L.divIcon in map.js): drop Leaflet's default white box. */
.wla-pin {
    background: none;
    border: none;
    filter: drop-shadow(0 3px 4px rgba(28, 25, 23, 0.35));
}
.wla-pin svg { display: block; }
