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

:root {
    --primary-color: #ff6b35;
    --secondary-color: #0b0b0b;
    --dark-bg: #1a1a1a;
    --header-sticky-offset: 92px;
    --light-bg: #f2f2f2; /* cooler off-white/grey */
    --text-dark: #333;
    --text-light: #666;
    --border-color: #ddd;
    --success-color: #28a745;
    --error-color: #dc3545;
    --control-min-height: 44px;
}

/* Global style switcher tokens */
html[data-ui-style="classic"] {
    --primary-color: #ff6b35;
    --secondary-color: #0b0b0b;
    --dark-bg: #1a1a1a;
    --light-bg: #f2f2f2;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #ddd;
}

html[data-ui-style="dark"] {
    --primary-color: #ff7d4f;
    --secondary-color: #f4f5f7;
    --dark-bg: #07080b;
    --light-bg: #0f1115;
    --text-dark: #f3f4f6;
    --text-light: #a6adbb;
    --border-color: #2a2f3a;
}

/* Surfline-inspired: cleaner ocean palette + soft depth */
html[data-ui-style="surfline"] {
    --primary-color: #00b4d8;
    --secondary-color: #023e8a;
    --dark-bg: #012138;
    --light-bg: #eff8ff;
    --text-dark: #0b2942;
    --text-light: #4c708f;
    --border-color: #c7ddf1;
}

/* Confuzine-inspired: editorial contrast + modern magenta accent */
html[data-ui-style="confuzine"] {
    --primary-color: #ff2e63;
    --secondary-color: #111111;
    --dark-bg: #0a0a0a;
    --light-bg: #f6f6f7;
    --text-dark: #161618;
    --text-light: #6a6a74;
    --border-color: #dadade;
}

/* New timeless editorial preset */
html[data-ui-style="editorial"] {
    --primary-color: #2563eb;
    --secondary-color: #0f172a;
    --dark-bg: #0f172a;
    --light-bg: #f7f8fa;
    --text-dark: #111827;
    --text-light: #6b7280;
    --border-color: #d9dee6;
}

/* Iteration 1: softer light neutral */
html[data-ui-style="editorial-soft"] {
    --primary-color: #3366cc;
    --secondary-color: #131a2a;
    --dark-bg: #131a2a;
    --light-bg: #f8f9fb;
    --text-dark: #121826;
    --text-light: #667085;
    --border-color: #dfe4ec;
}

/* Iteration 2: warm modern light */
html[data-ui-style="editorial-warm"] {
    --primary-color: #2f6fdf;
    --secondary-color: #1d1b19;
    --dark-bg: #1d1b19;
    --light-bg: #faf7f2;
    --text-dark: #1f1a16;
    --text-light: #72665a;
    --border-color: #e7ddd1;
}

/* Iteration 3: cool airy light */
html[data-ui-style="editorial-cool"] {
    --primary-color: #2b73c8;
    --secondary-color: #102333;
    --dark-bg: #102333;
    --light-bg: #f3f8fb;
    --text-dark: #102331;
    --text-light: #5f7384;
    --border-color: #d7e4ee;
}

/* Theme (default = light) */
html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --light-bg: #0f1115;
    --dark-bg: #07080b;
    --text-dark: #f3f4f6;
    --text-light: #a6adbb;
    --border-color: #2a2f3a;
}

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

/* Dark mode surfaces (keep accent orange) */
html[data-theme="dark"] .submit-section,
html[data-theme="dark"] .events-table,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .sidebar-panel,
html[data-theme="dark"] .feed-panel,
html[data-theme="dark"] .page-sidebar,
html[data-theme="dark"] .auth-modal-card,
html[data-theme="dark"] .feed-tile,
html[data-theme="dark"] .event-type-dropdown-menu,
html[data-theme="dark"] #userMenuDropdown {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.10) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* Keep dark-mode popups fully readable (no transparent card effect). */
html[data-theme="dark"] .auth-modal-card {
    background: #171a22;
    border: 1px solid rgba(255,255,255,0.16);
    color: var(--text-dark);
}

html[data-theme="dark"] .auth-modal-backdrop {
    background: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .submit-section,
html[data-theme="dark"] .events-table,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .sidebar-panel,
html[data-theme="dark"] .page-sidebar {
    color: var(--text-dark);
}

html[data-theme="dark"] .feed-panel-title,
html[data-theme="dark"] .feed-tile-meta {
    color: var(--text-light);
}

html[data-theme="dark"] .feed-panel {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.12);
}

html[data-theme="dark"] .feed-link,
html[data-theme="dark"] .feed-tile {
    color: var(--text-dark);
}

html[data-theme="dark"] #homeNewsSection .feed-link {
    background: rgba(255,255,255,0.04);
}

html[data-theme="dark"] .section-header h2,
html[data-theme="dark"] .event-header h2,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 {
    color: var(--text-dark);
}

html[data-theme="dark"] .form-group input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea {
    background: rgba(0,0,0,0.25);
    color: var(--text-dark);
    border-color: rgba(255,255,255,0.14);
}

html[data-theme="dark"] .event-types-group label {
    background: rgba(0,0,0,0.18);
    border-color: rgba(255,255,255,0.16);
    color: var(--text-dark);
}

html[data-theme="dark"] .event-types-group label:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.22);
}

html[data-theme="dark"] .event-types-group label:has(input:checked) {
    background: rgba(255,107,53,0.14);
    border-color: rgba(255,107,53,0.70);
    box-shadow: 0 0 0 2px rgba(255,107,53,0.18);
}

html[data-theme="dark"] .newest-event-card {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.14);
    color: var(--text-dark);
}

html[data-theme="dark"] .event-type-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
}

html[data-theme="dark"] footer {
    background: #0b0c10;
}

/* Shared style switcher menu section */
.style-switcher-group {
    border-top: 1px solid rgba(0,0,0,0.22);
    margin-top: 0.2rem;
    padding: 0.45rem 0.45rem 0.25rem;
}

.style-nav-group {
    border-top: 1px solid rgba(0,0,0,0.22);
    padding: 0.2rem 0 0.3rem;
    display: none;
}

.style-nav-group a {
    display: block;
    width: 100%;
    text-decoration: none;
    text-align: left;
    padding: 0.62rem 0.82rem;
    color: #000;
    font-weight: 800;
}

.style-nav-group a:hover {
    background: rgba(255,255,255,0.35);
}

.style-switcher-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 900;
    color: rgba(0,0,0,0.72);
    margin: 0 0 0.3rem;
    padding: 0 0.3rem;
}

.style-switcher-btn {
    display: block;
    width: 100%;
    border: 1px solid rgba(0,0,0,0.25);
    background: #fff;
    color: #000;
    border-radius: 8px;
    text-align: left;
    padding: 0.46rem 0.6rem;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.style-switcher-btn:hover {
    background: #f7f7f8;
}

.style-switcher-btn.is-active {
    border-color: #000;
    background: var(--primary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: #0b0b0b;
    color: #fff;
    padding: 2rem 0;
    text-align: center;
    box-shadow: none;
    margin-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
}

html[data-ui-style="surfline"] header {
    background: #045a8d;
    border-bottom: 2px solid rgba(255,255,255,0.35);
}

html[data-ui-style="surfline"] .style-nav-group {
    display: block;
}

html[data-ui-style="surfline"] #homeEventsSection {
    display: none !important;
}

html[data-ui-style="surfline"] .home-layout-shell {
    grid-template-areas:
        "newest"
        "map"
        "news";
}

@media (min-width: 1100px) {
    html[data-ui-style="surfline"] .home-layout-shell {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "newest map"
            "news map";
    }
}

html[data-ui-style="surfline"] #homeNewsSection {
    display: block !important;
}

html[data-ui-style="surfline"] .submit-section,
html[data-ui-style="surfline"] .event-card,
html[data-ui-style="surfline"] .events-table {
    border-radius: 16px;
    border: 1px solid #d4e8f7;
    box-shadow: 0 10px 28px rgba(3,52,94,0.08);
}

html[data-ui-style="surfline"] .submit-btn,
html[data-ui-style="surfline"] .clear-dates-btn,
html[data-ui-style="surfline"] .location-btn {
    border-radius: 999px;
    background: #0077b6;
    color: #fff;
    border: 1px solid #00507a;
}

html[data-ui-style="confuzine"] header {
    background: #1a1a20;
    border-bottom: 3px solid #ff2e63;
}

html[data-ui-style="confuzine"] .site-brand {
    border-color: #ff2e63;
    background: #121216;
}

html[data-ui-style="confuzine"] .submit-section,
html[data-ui-style="confuzine"] .event-card {
    border: 1px solid #dcdce1;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(20,20,30,0.08);
}

html[data-ui-style="confuzine"] .section-header h2,
html[data-ui-style="confuzine"] .feed-panel-title {
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

html[data-ui-style="confuzine"] .submit-btn,
html[data-ui-style="confuzine"] .clear-dates-btn {
    background: #d61c7d;
    color: #fff;
    border: 1px solid #941244;
}

html[data-ui-style="confuzine"] .header-map-quick-btn {
    display: flex !important;
}

html[data-ui-style="confuzine"] .confuzine-map-cta {
    display: inline-flex !important;
    align-items: center;
}

html[data-ui-style="confuzine"] #homeNewsSection {
    display: block !important;
}

/* Editorial family: timeless, readable, no gradients */
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) body {
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) header {
    background: #fff;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .site-brand,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .user-chip,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .user-menu-btn,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) #userMenuDropdown {
    border-radius: 10px;
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .submit-section,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .event-card,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .feed-panel,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .page-sidebar,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .events-table {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16,24,40,0.06);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .submit-section h2,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .section-header h2,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .feed-panel-title {
    color: var(--secondary-color);
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .feed-section-toggle {
    background: #eef2f7;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .feed-tile {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .submit-btn,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .clear-dates-btn,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .location-btn {
    background: var(--primary-color);
    color: #fff;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 8px;
    font-weight: 600;
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .submit-btn:hover,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .clear-dates-btn:hover,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .location-btn:hover {
    filter: brightness(0.95);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group input:not([type="checkbox"]):not([type="radio"]),
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group select,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group textarea {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-dark);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group input:focus,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group select:focus,
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(31,111,235,0.16);
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .style-nav-group {
    display: block;
}

:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) #homeHeroSection {
    border: 1px solid var(--border-color);
}

/* Editorial family layout structure */
:is(
    html[data-ui-style="editorial"],
    html[data-ui-style="editorial-soft"],
    html[data-ui-style="editorial-warm"],
    html[data-ui-style="editorial-cool"]
) .home-layout-shell {
    grid-template-areas:
        "newest"
        "map"
        "events"
        "news";
    gap: 1rem;
}

@media (min-width: 1100px) {
    :is(
        html[data-ui-style="editorial"],
        html[data-ui-style="editorial-soft"],
        html[data-ui-style="editorial-warm"],
        html[data-ui-style="editorial-cool"]
    ) .home-layout-shell {
        grid-template-columns: 1.25fr 1fr;
        grid-template-areas:
            "newest map"
            "events events"
            "news news";
        gap: 1.25rem;
    }
}

/* Readability-first section sizing for Surfline/Confuzine */
html[data-ui-style="surfline"] .home-layout-shell,
html[data-ui-style="confuzine"] .home-layout-shell {
    gap: 1.25rem;
}

html[data-ui-style="surfline"] .home-layout-shell > section,
html[data-ui-style="confuzine"] .home-layout-shell > section {
    min-height: 320px;
    padding: 2rem 2rem 1.8rem;
    border-radius: 18px;
}

html[data-ui-style="surfline"] .home-layout-shell > section h2,
html[data-ui-style="confuzine"] .home-layout-shell > section h2 {
    font-size: clamp(1.55rem, 2.1vw, 2rem);
    margin-bottom: 1rem;
}

html[data-ui-style="surfline"] #homeHeroSection p,
html[data-ui-style="confuzine"] #homeHeroSection p {
    font-size: 1.03rem;
    line-height: 1.7;
    max-width: 70ch;
}

html[data-ui-style="surfline"] .newest-events-carousel,
html[data-ui-style="confuzine"] .newest-events-carousel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    overflow: visible;
}

html[data-ui-style="surfline"] .newest-event-card,
html[data-ui-style="confuzine"] .newest-event-card {
    min-width: 0;
    max-width: none;
    padding: 1rem 1.05rem;
    border-radius: 14px;
}

html[data-ui-style="surfline"] #homeNewsSection .feed-link,
html[data-ui-style="confuzine"] #homeNewsSection .feed-link {
    display: block;
    padding: 0.72rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    font-size: 0.98rem;
    line-height: 1.4;
}

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

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    border: 3px solid var(--primary-color);
    padding: 0.35rem 0.6rem;
    border-radius: 16px;
    background: #0b0b0b; /* match header background */
    min-width: 0;
    max-width: 100%;
}

/* Ensure hamburger dropdown always sits above interactive layers (maps, overlays). */
#userMenuDropdown {
    z-index: 20050 !important;
}

#userMenuDropdown.user-menu-dropdown {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.hamburger-menu-group {
    border-radius: 12px;
    padding: 0.35rem 0.3rem 0.5rem;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.45);
}

.hamburger-menu-group--site {
    background: rgba(255, 255, 255, 0.22);
}

.hamburger-menu-group-label {
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.65rem 0.35rem;
    opacity: 0.82;
}

.hamburger-menu-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.hamburger-menu-group-items .style-nav-group {
    margin-top: 0.35rem;
}

/* Visual style lives last on the dropdown (after Website + Account bubbles) */
#userMenuDropdown.user-menu-dropdown > .style-switcher-group {
    border-radius: 12px;
    padding: 0.35rem 0.3rem 0.5rem;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.22);
}

html[data-theme="dark"] #userMenuDropdown.user-menu-dropdown > .style-switcher-group {
    background: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] #userMenuDropdown.user-menu-dropdown {
    background: var(--primary-color) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .hamburger-menu-group {
    background: rgba(0, 0, 0, 0.38);
    border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .hamburger-menu-group--site {
    background: rgba(0, 0, 0, 0.22);
}

.site-brand-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.site-brand-text {
    border: none;
    padding: 0;
}

.site-brand-text h1 {
    margin-bottom: 0.15rem;
    line-height: 1.1;
    font-size: clamp(1.25rem, 3.2vw, 2.4rem);
}

.site-brand-text p {
    margin: 0;
}

.site-logo {
    width: clamp(56px, 8vw, 90px);
    height: clamp(56px, 8vw, 90px);
    object-fit: contain;
    border-radius: 12px;
    flex-shrink: 0;
    background: #000;
}

main {
    padding: 2rem 0;
}

/* Two-column shell (main + sticky sidebar) */
.page-shell {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    padding: 2rem 20px;
    max-width: 1500px;
    margin: 0 auto;
}
.page-main {
    flex: 0 1 1200px;
    min-width: 0;
}
.page-sidebar {
    width: 340px;
    flex: 0 0 340px;
    position: sticky;
    top: var(--header-sticky-offset);
    align-self: flex-start;
    height: calc(100vh - var(--header-sticky-offset));
    overflow-y: auto;
    overflow-x: hidden;
    background: #ededed;
    border-radius: 12px;
    padding: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mobile-feed.feed-panel {
    background: #ededed;
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid #d7d7d7;
}
.page-sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
}
@media (max-width: 1120px) {
    .page-shell {
        flex-direction: column;
        padding: 2rem 0;
    }
    .page-sidebar {
        display: none;
    }
    .mobile-feed { display: block; }
}

/* Header user menu sizing */
.user-menu-stack { display:flex; flex-direction:column; gap:0.45rem; align-items:flex-end; flex-shrink: 0; }
.user-menu-stack .user-chip { width: clamp(88px, 13vw, 120px); display:block; text-align:center; white-space:normal; word-break:break-word; line-height:1.2; font-size: clamp(0.7rem, 0.95vw, 0.95rem); }
.user-menu-stack .user-menu-btn { width: clamp(88px, 13vw, 120px); }
.mobile-feed { display: none; }
.feed-panel {
    border: 1px solid #d7d7d7;
    background: #f3f3f3;
}
.feed-panel-title {
    margin: 0 0 0.65rem 0;
    padding: 0 0 0.35rem 0;
    border-bottom: 1px solid #d3d3d3;
    background: transparent;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.95rem;
    font-weight: 900;
}
.feed-panel-body {
    display: grid;
    gap: 0.9rem;
}
.feed-section {
    border-top: 1px solid #e5e5e5;
    padding-top: 0.7rem;
}
.feed-section:first-child {
    border-top: none;
    padding-top: 0;
}
.feed-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 700;
}
.feed-link:hover {
    color: var(--primary-color);
}
.feed-list {
    display: grid;
    gap: 0.5rem;
}
.feed-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 2px solid #000;
    background: var(--primary-color);
    color: #000;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font-weight: 900;
    cursor: pointer;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.feed-section-toggle:hover {
    background: #e55a2b;
}
.feed-section-toggle .feed-section-chevron {
    transition: transform 0.15s ease;
}
.feed-section-toggle[aria-expanded="false"] .feed-section-chevron {
    transform: rotate(-90deg);
}
.feed-section-content {
    margin-top: 0.45rem;
}
.feed-tile {
    display: block;
    text-decoration: none;
    color: var(--text-dark);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.feed-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    border-color: #bdbdbd;
}

[data-event-tile] {
    cursor: pointer;
}
.feed-tile-title {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.18rem;
}

.feed-tile-type,
.newest-event-type {
    display: inline-block;
    font-size: 0.74rem;
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary-color);
    margin-bottom: 0.22rem;
}
.feed-tile-meta {
    color: var(--text-light);
    font-size: 0.82rem;
    line-height: 1.2;
}

.feed-tile-when,
.newest-event-when {
    color: var(--text-light);
    font-size: 0.8rem;
    line-height: 1.3;
    margin-top: 0.2rem;
}

.event-tile-description {
    margin-top: 0.35rem;
    font-size: 0.87rem;
    line-height: 1.35;
    color: var(--text-dark);
}

.event-tile-divider {
    height: 1px;
    width: 100%;
    margin-top: 0.42rem;
    margin-bottom: 0.1rem;
    background: rgba(0,0,0,0.15);
}

.event-tile-description.is-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-tile-expand-btn {
    margin-top: 0.38rem;
    border: 1px solid #000;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dark);
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-row {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.search-container {
    position: relative;
    width: 100%;
    margin: 0;
}

.date-filter-row {
    margin: 0.75rem auto 0;
    max-width: 1200px;
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}

.date-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 180px;
    flex: 1;
}

.date-filter-group label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.date-filter-group input[type="date"] {
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.clear-dates-btn {
    border: none;
    background: var(--primary-color);
    color: #000;
    border: 2px solid #000;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
}

.clear-dates-btn:hover {
    background: #e55a2b;
}

#citySearch,
#countrySearch,
#eventNameSearch {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    outline: none;
    transition: all 0.3s;
    background: #fff;
}

#citySearch:focus,
#countrySearch:focus,
#eventNameSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: #000;
    border: 2px solid #000;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.clear-btn:hover {
    background: #e55a2b;
}

.search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    z-index: 40;
    max-height: 220px;
    overflow-y: auto;
}

.search-suggestion-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.search-suggestion-item:hover {
    background: #f3f7fb;
}

/* Map Section */
.map-section {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0.75rem;
    margin-bottom: 3rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    clear: both;
    position: relative;
    z-index: 1;
}

.map-section.map-pick-expanded {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 72px; /* below the header */
    bottom: 12px;
    max-width: none;
    margin: 0;
    z-index: 9999;
}

.map-section.map-pick-expanded .map-container {
    aspect-ratio: auto;
    height: 100%;
    min-height: 0;
}

/* Event pick map (separate from main events map) */
.event-pick-map-panel {
    margin-top: 0.85rem;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

.event-pick-map-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.event-pick-map-canvas {
    width: 100%;
    height: 380px;
    background: #e0e0e0;
    position: relative;
}

.event-pick-map-canvas .loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-size: 1.05rem;
    color: var(--text-light);
    /* Ensure the loading overlay never blocks map interaction/click-to-pick. */
    pointer-events: none;
}

.map-container {
    width: 100%;
    aspect-ratio: 5 / 3;
    height: auto;
    min-height: 320px;
    background: #e0e0e0;
    position: relative;
}

/* Map container styles */
#map {
    width: 100%;
    height: 100%;
}

.custom-marker {
    background: transparent !important;
    border: none !important;
}

/* Location filter section */
.location-section {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.location-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.location-btn {
    background: var(--primary-color);
    color: #000;
    padding: 0.6rem 1.4rem;
    border: 2px solid #000;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.25s, transform 0.1s;
}

.location-btn:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

.distance-control {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.distance-control label {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
}

.distance-control input[type="range"] {
    width: 100%;
}

.location-status {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Demo user switcher */
.user-switcher {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.user-switcher-info {
    color: #f1f1f1;
}

.user-switcher-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-switcher-btn {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.user-switcher-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.user-switcher-btn-secondary {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.25);
}

/* Events Section */
.events-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--secondary-color);
}

.controls {
    display: flex;
    gap: 1rem;
}

.controls select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.controls select:focus {
    border-color: var(--primary-color);
}

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

.event-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

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

.event-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #e9e9e9;
}

.event-content {
    padding: 1.5rem;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.event-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.event-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 400;
}

.event-details {
    margin-bottom: 1rem;
}

.event-detail {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.event-detail strong {
    margin-right: 0.5rem;
    color: var(--text-dark);
}

.event-description {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Preset-specific event card composition (layout/structure) */
html[data-ui-style="surfline"] .event-card {
    border-radius: 16px;
    overflow: hidden;
}

html[data-ui-style="surfline"] .event-content {
    padding: 1.1rem 1.2rem;
}

html[data-ui-style="surfline"] .event-header {
    align-items: center;
    gap: 0.75rem;
}

html[data-ui-style="surfline"] .event-name {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

html[data-ui-style="surfline"] .event-type {
    background: #0077b6;
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,0.2);
}

html[data-ui-style="surfline"] .event-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    margin-bottom: 0.7rem;
}

html[data-ui-style="surfline"] .event-detail {
    margin-bottom: 0;
    font-size: 0.9rem;
}

html[data-ui-style="surfline"] .event-description {
    -webkit-line-clamp: 2;
    font-size: 0.87rem;
    color: #416887;
}

html[data-ui-style="confuzine"] .event-card {
    border-radius: 14px;
    border-left: 5px solid #ff2e63;
    box-shadow: 0 10px 24px rgba(20,20,30,0.08);
}

html[data-ui-style="confuzine"] .event-photo {
    height: 150px;
    filter: grayscale(0.12) contrast(1.03);
}

html[data-ui-style="confuzine"] .event-content {
    padding: 1.1rem 1.15rem 1rem;
}

html[data-ui-style="confuzine"] .event-header {
    align-items: flex-start;
}

html[data-ui-style="confuzine"] .event-name {
    font-size: 1.18rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

html[data-ui-style="confuzine"] .event-type {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.72rem;
    padding: 0.26rem 0.55rem;
    border-radius: 6px;
    background: #151515;
    color: #fff;
    border: 1px solid #ff2e63;
}

html[data-ui-style="confuzine"] .event-details {
    border-top: 1px solid #e6e6ea;
    border-bottom: 1px solid #e6e6ea;
    padding: 0.5rem 0;
}

html[data-ui-style="confuzine"] .event-detail {
    font-size: 0.88rem;
    margin-bottom: 0.38rem;
}

html[data-ui-style="confuzine"] .event-description {
    -webkit-line-clamp: 4;
    font-size: 0.9rem;
    color: #4f4f59;
}

html[data-ui-style="confuzine"] .event-actions {
    justify-content: flex-end;
}

html[data-ui-style="confuzine"] .like-btn {
    border-radius: 8px;
    font-size: 0.84rem;
    padding: 0.45rem 0.65rem;
}

@media (min-width: 980px) {
    html[data-ui-style="surfline"] .event-card {
        display: grid;
        grid-template-columns: 160px minmax(0, 1fr);
        align-items: stretch;
    }

    html[data-ui-style="surfline"] .event-photo {
        height: 100%;
        min-height: 160px;
    }

    html[data-ui-style="surfline"] .event-content {
        padding: 0.95rem 1rem 0.9rem;
    }

    html[data-ui-style="surfline"] .event-description {
        -webkit-line-clamp: 2;
    }
}

.like-btn {
    border: 2px solid #000;
    background: var(--primary-color);
    color: #000;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.like-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.10);
    background: #e55a2b;
}

.like-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.like-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}
.no-events {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.newest-events-carousel {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.25rem;
}

.newest-events-carousel::-webkit-scrollbar {
    height: 8px;
}

.newest-events-carousel::-webkit-scrollbar-thumb {
    background: #c7cbd3;
    border-radius: 999px;
}

.newest-event-card {
    min-width: 260px;
    max-width: 300px;
    flex: 0 0 auto;
    scroll-snap-align: start;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: #fff;
    color: var(--text-dark);
    text-decoration: none;
    padding: 0.85rem 0.9rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.newest-event-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.newest-event-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.newest-event-meta {
    font-size: 0.92rem;
    color: var(--text-light);
    margin-bottom: 0.2rem;
}

.newest-event-date {
    font-size: 0.86rem;
    color: var(--text-light);
}

/* Submit Form */
.submit-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.submit-section h2 {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

/* Homepage layout presets (structure, not only colors) */
.home-layout-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    grid-template-areas:
        "newest"
        "map"
        "events";
}

.home-layout-shell > section {
    margin-bottom: 0 !important;
}

#homeHeroSection { grid-area: hero; }
#homeNewestSection { grid-area: newest; }
#homeNewsSection { grid-area: news; }
#homeMapExplorerSection { grid-area: map; }
#homeSearchSection { grid-area: search; }
#homeEventsSection { grid-area: events; }

html[data-ui-style="classic"] .home-layout-shell {
    grid-template-areas:
        "newest"
        "map"
        "events";
}

html[data-ui-style="dark"] .home-layout-shell {
    grid-template-areas:
        "newest"
        "map"
        "events";
}

html[data-ui-style="confuzine"] .home-layout-shell {
    grid-template-areas:
        "newest"
        "map"
        "events";
}

@media (min-width: 1100px) {
    html[data-ui-style="dark"] .home-layout-shell {
        grid-template-columns: 1.25fr 1fr;
        grid-template-areas:
            "newest map"
            "events events";
    }

    html[data-ui-style="confuzine"] .home-layout-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "newest"
            "map"
            "events";
    }

    html[data-ui-style="classic"] .home-layout-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "newest"
            "map"
            "events";
    }
}

/* Homepage: map explorer as one card (filters + map + location) */
.home-map-explorer-card {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.home-map-explorer-card .search-row,
.home-map-explorer-card .date-filter-row {
    max-width: 100%;
}

.home-map-explorer-card .search-section {
    margin-bottom: 1.25rem;
}

.home-map-explorer-card .map-section {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.home-map-explorer-card .map-container {
    max-width: 100%;
    box-sizing: border-box;
}

.home-map-explorer-card #map {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.home-map-explorer-card .location-section {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0.85rem 0 0;
    margin-top: 0.75rem;
    margin-bottom: 0;
    border-top: 1px solid var(--border-color);
}

.home-map-explorer-card.submit-section .home-map-explorer-intro h2 {
    margin-bottom: 0.65rem;
}

#homeEventsSection.home-upcoming-events-card {
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Ensure big checkbox grids always start on a new row (full width) */
.form-grid > .form-group:has(.event-types-group) {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.2;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
    min-height: var(--control-min-height);
    line-height: 1.25;
}

/* Never apply full-width input styling to checkbox/radio */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

/* Prevent select shrinking/misalignment across browsers */
.form-group select {
    display: block;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    line-height: 1.25;
    min-height: var(--control-min-height);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23000' d='M1.4 1.1L6 5.7l4.6-4.6L12 2.5 6 8 0 2.5z'/%3E%3C/svg%3E");
    background-position: calc(100% - 12px) 50%;
    background-size: 12px 8px;
    background-repeat: no-repeat;
    padding-right: 2.2rem;
}

/* Textareas should be allowed to grow; don't force 44px height */
.form-group textarea {
    min-height: unset;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.submit-btn {
    background: var(--primary-color);
    color: #000;
    padding: 1rem 2rem;
    border: 2px solid #000;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}

.submit-btn:hover {
    background: #e55a2b;
}

.submit-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.48rem 0.85rem;
    border: 2px solid #000;
    border-radius: 999px;
    background: #fff;
    color: var(--secondary-color);
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, transform 0.12s;
}

.back-link:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.back-link:focus-visible {
    outline: 3px solid rgba(255, 107, 53, 0.45);
    outline-offset: 2px;
}

html[data-theme="dark"] .back-link {
    background: #171a22;
    border-color: rgba(255,255,255,0.24);
    color: var(--text-dark);
}

html[data-theme="dark"] .back-link:hover {
    background: #1f2430;
    border-color: var(--primary-color);
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 5px;
    display: none;
}

.form-message.success {
    background: #d4edda;
    color: var(--success-color);
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background: #f8d7da;
    color: var(--error-color);
    border: 1px solid #f5c6cb;
    display: block;
}

/* Auth modal */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.auth-modal-card {
    position: relative;
    width: min(460px, calc(100% - 24px));
    margin: 8vh auto 0;
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.auth-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 1rem;
    height: 1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    color: var(--text-light);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
}

.auth-close::before,
.auth-close::after {
    content: '';
    position: absolute;
    width: 0.55rem;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.auth-close::before {
    transform: rotate(45deg);
}

.auth-close::after {
    transform: rotate(-45deg);
}

.auth-close:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    transform: scale(1.04);
}

.auth-close:focus-visible {
    outline: 3px solid rgba(255, 107, 53, 0.45);
    outline-offset: 2px;
}

#howItWorksCloseBtn.auth-close {
    width: 2rem;
    height: 2rem;
}

#howItWorksCloseBtn.auth-close::before,
#howItWorksCloseBtn.auth-close::after {
    width: 0.95rem;
}

.auth-form {
    display: grid;
    gap: 0.75rem;
}

.auth-form a {
    color: var(--primary-color);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-form a:hover {
    filter: brightness(0.92);
}

.event-types-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    align-items: start;
}

/* Medium screens: 2 columns */
@media (max-width: 686px) {
    .event-types-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Small screens: 1 column */
@media (max-width: 538px) {
    .event-types-group {
        grid-template-columns: 1fr;
    }
}

.event-types-group label {
    margin: 0;
    font-weight: 400;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.4rem;
    text-align: left;
    line-height: 1.2;
    min-height: 2.15em; /* prevent row height jitter across columns */
    padding: 0.2rem 0.3rem;
    border-radius: 8px;
    align-self: stretch;
    border: 1px solid #d9d9d9; /* outline per option */
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.event-types-group input[type="checkbox"],
.event-types-group input[type="radio"] {
    margin-top: 0.15rem;
}

.event-types-group label:hover {
    border-color: #bdbdbd;
    background: #fafafa;
}

/* Selected state (modern browsers) */
.event-types-group label:has(input:checked) {
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.22);
    background: rgba(255, 107, 53, 0.10);
}

.filter-types-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background: #fff;
}

.filter-types-checks label {
    margin: 0;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

/* Sponsor row: visually grouped + nicer delete button label */
.sponsors-rows .sponsor-row {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.65rem;
    background: #fff;
}

.sponsors-rows .sponsor-row .sponsor-remove {
    white-space: nowrap;
}

.event-type-filter-select-v1,
.event-type-filter-select-v2,
.event-type-filter-select-v3,
.event-type-filter-select-v4 {
    width: 100%;
    padding: 1rem 1.2rem;
    font-size: 1.05rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: #fff;
    outline: none;
    height: auto;
}

.event-type-dropdown-trigger {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    outline: none;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}

.event-type-dropdown-caret {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-left: auto;
}

.event-type-dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    z-index: 45;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.4rem 0.75rem;
}

.event-type-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.25rem;
    cursor: pointer;
    user-select: none;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 400;
}

.event-type-dropdown-item:hover {
    background: #f4f7fb;
}

.sponsors-rows .sponsor-row input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sponsors-rows .sponsor-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.inline-link-btn {
    display: inline;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--primary-color);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.inline-link-btn:hover {
    color: #e55a2b;
}

/* Hide CKEditor notification popups (incl. version/security warning). */
.cke_notifications_area,
.cke_notification,
.cke_notification_warning {
    display: none !important;
}

footer {
    background: var(--dark-bg);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}
.footer-version {
    margin-top: 0.45rem;
    color: #d7d7d7;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Admin nav responsiveness + safe overflow handling */
.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-nav-links {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    min-width: 0;
}

.admin-nav-links a {
    white-space: nowrap;
}

.admin-menu-wrap {
    position: relative;
    display: none;
}

.admin-menu-btn {
    border: 2px solid #000;
    background: var(--primary-color);
    color: #000;
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    line-height: 1;
}

.admin-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: var(--primary-color);
    border: 2px solid #000;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.2);
    z-index: 21000;
    display: none;
}

.admin-menu-dropdown a {
    display: block;
    width: 100%;
    padding: 0.62rem 0.82rem;
    color: #000;
    text-decoration: none;
    font-weight: 800;
}

.admin-menu-dropdown a:hover {
    background: rgba(255,255,255,0.35);
}

.events-table,
.users-wrap,
.form-container,
.submit-section {
    max-width: 100%;
    min-width: 0;
}

.events-table {
    overflow-x: auto !important;
}

.users-wrap {
    overflow-x: auto;
}

.users-table {
    min-width: 880px;
}

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

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem 0;
    }
    header .container > div {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.65rem;
    }
    /* Make brand block feel like full-height header pill */
    .site-brand {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        border-radius: 18px;
    }
    .site-brand {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }
    .site-brand-text p {
        display: none; /* preserve horizontal space for controls */
    }
    .user-menu-stack {
        gap: 0.35rem;
    }
    .user-menu-stack .user-chip,
    .user-menu-stack .user-menu-btn {
        width: 86px;
    }
    .search-row {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .map-container {
        min-height: 260px;
    }
    
    .events-list {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls {
        width: 100%;
    }
    
    .controls select {
        flex: 1;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }

    .sponsors-rows .sponsor-row {
        grid-template-columns: 1fr !important;
        gap: 0.45rem !important;
    }

    #userMenuDropdown {
        min-width: 170px !important;
        right: 0;
        z-index: 20050 !important; /* keep dropdown clickable above maps/overlays */
    }

    .admin-nav-links {
        display: none;
    }

    .admin-menu-wrap {
        display: block;
    }

    html[data-ui-style="surfline"] .home-layout-shell > section,
    html[data-ui-style="confuzine"] .home-layout-shell > section {
        min-height: 0;
        padding: 1.25rem 1rem;
    }

    html[data-ui-style="surfline"] .newest-events-carousel,
    html[data-ui-style="confuzine"] .newest-events-carousel {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    .site-logo {
        width: 50px;
        height: 50px;
    }
    .site-brand-text h1 {
        font-size: 1.1rem;
    }
    .submit-section {
        padding: 1rem;
    }
    .user-menu-stack .user-chip,
    .user-menu-stack .user-menu-btn {
        width: 78px;
        font-size: 0.78rem;
    }
}
