:root {
    /* iOS safe area support */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
    /* Colors */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --success-500: #10b981;
    --success-600: #059669;
    --warning-500: #f59e0b;
    --error-500: #ef4444;

    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Radius */
    --radius-sm: 0.125rem;
    --radius-md: 0.25rem;
    --radius-lg: 0.375rem;
    --radius-xl: 0.5rem;
    --radius-2xl: 0.75rem;
    --radius-3xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.03);
    --shadow-md: 0 2px 4px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 4px 8px 0 rgb(0 0 0 / 0.06);
    --shadow-xl: 0 6px 12px 0 rgb(0 0 0 / 0.08);
    --shadow-2xl: 0 8px 16px 0 rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--gray-900);
    font-size: var(--font-size-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #1e40af 0%, #3730a3 50%, #1e3a8a 100%);
    color: white;
    padding: var(--space-4);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 100%
    );
    pointer-events: none;
}

.header h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-1);
    color: white;
    letter-spacing: -0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: var(--font-weight-medium);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.main-content {
    display: flex;
    gap: var(--space-8);
    flex: 1;
    align-items: flex-start;
}

.sidebar {
    width: 320px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.mobile-menu-toggle {
    display: none;
    background: rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(10px);
    color: var(--primary-600);
    border: none;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    margin: var(--space-4);
    border-radius: var(--radius-xl);
    align-items: center;
    justify-content: center;
    min-width: 130px;
    min-height: 50px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.mobile-menu-toggle #filterToggleText {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-menu-toggle:hover {
    background: var(--primary-500);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mobile-menu-toggle.active {
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-lg);
}

.filters {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--gray-200);
}

.filters h3 {
    margin: 0;
    color: var(--gray-800);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.025em;
}

.filters-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-bottom: var(--space-10);
    margin-bottom: var(--space-6);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-group label {
    font-weight: var(--font-weight-semibold);
    color: var(--gray-700);
    font-size: var(--font-size-sm);
    letter-spacing: 0.025em;
}

.filter-group input,
.filter-group select {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: none;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

.stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid #f1f5f9;
    background: white;
    padding-bottom: var(--space-4);
    margin-top: auto;
}

.event-count {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-600);
    letter-spacing: -0.025em;
}

.clear-filters {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-500);
    border: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    font-size: var(--font-size-sm);
    min-width: 130px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    gap: 8px;
    flex: 1;
}

.clear-filters:hover {
    background: var(--error-500);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.copy-list-btn {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    font-size: var(--font-size-sm);
    min-width: 130px;
    height: 36px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    gap: 8px;
}

.copy-list-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    min-width: 0;
}

.events-header {
    padding: var(--space-2) var(--space-3);
    background: white;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.events-container {
    flex: 1;
    padding: var(--space-6);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-4);
    padding: 0;
}

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

.event-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(220, 220, 220, 0.6);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 1);
    border-color: var(--gray-300);
}

.event-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
}

.event-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-3);
    color: var(--gray-800);
    line-height: 1.4;
    letter-spacing: -0.025em;
}

.event-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 8px;
    align-items: start;
}

@media (min-width: 769px) {
    .event-details {
        grid-template-columns: 1fr 1fr;
        gap: 12px 20px;
    }
}

.event-detail {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    font-weight: var(--font-weight-normal);
    min-width: 0;
}

.event-location-row {
    margin-top: 8px;
    margin-bottom: 15px;
}

.event-location {
    /* Location field - allow wrapping for long location names */
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

.detail-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-tags {
    margin-bottom: var(--space-3);
}

.tag {
    display: inline-block;
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    margin-right: var(--space-2);
    margin-bottom: var(--space-2);
    transition: all var(--transition-fast);
}

.event-links {
    display: flex;
    gap: var(--space-3);
}

.event-link {
    padding: var(--space-2) var(--space-3);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.website-link {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-500);
    border: none;
}

.website-link:hover {
    background: var(--success-500);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.facebook-link {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-500);
    border: none;
}

.facebook-link:hover {
    background: var(--primary-500);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.no-events {
    text-align: center;
    padding: 48px;
    color: var(--gray-500);
    font-size: 1.125rem;
    font-weight: 400;
}

.loading {
    text-align: center;
    padding: 48px;
    color: var(--gray-500);
    font-size: 1.125rem;
    font-weight: 400;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-bottom: 2px solid #f1f5f9;
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: white;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: calc(20px + var(--safe-area-top))
            calc(20px + var(--safe-area-right))
            calc(120px + var(--safe-area-bottom))
            calc(20px + var(--safe-area-left));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        height: 100vh;
        height: 100dvh;
        overscroll-behavior: contain;
        scroll-behavior: smooth;
        touch-action: pan-y;
    }

    .sidebar.mobile-open {
        display: block;
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .events-header {
        padding: 12px 15px;
    }

    .events-container {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .header {
        padding: var(--space-2) var(--space-3);
    }

    .header h1 {
        font-size: var(--font-size-xl);
        margin-bottom: 0;
    }

    .header p {
        font-size: var(--font-size-xs);
    }

    .events-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .event-card {
        padding: var(--space-3);
    }

    .event-details {
        flex-direction: column;
        gap: var(--space-2);
        margin-bottom: var(--space-2);
    }

    .event-location-row {
        margin-top: var(--space-2);
        margin-bottom: var(--space-3);
    }

    .filters-grid {
        gap: var(--space-3);
    }

    .sidebar {
        padding: calc(var(--space-3) + var(--safe-area-top))
            calc(var(--space-3) + var(--safe-area-right))
            calc(200px + var(--safe-area-bottom))
            calc(var(--space-3) + var(--safe-area-left));
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        scroll-behavior: smooth;
        touch-action: pan-y;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .mobile-menu-toggle {
        margin: var(--space-3);
        min-width: 130px;
        min-height: 48px;
        padding: var(--space-2);
    }

    .events-container {
        padding: var(--space-4);
    }
}

.sidebar-close {
    display: none;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-600);
    border: none;
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    box-shadow: none;
    transition: all var(--transition-normal);
}

.sidebar-close:hover {
    background: var(--success-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 1024px) {
    .sidebar-close {
        display: flex;
    }
}

.icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

.icon-lg {
    width: 22px;
    height: 22px;
}

/* Additional mobile scrolling fixes */
@media (max-width: 1024px) {
    .sidebar .filters {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 120px);
        height: calc(100dvh - 120px);
        overflow: hidden;
    }

    .sidebar .filters-grid {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: var(--space-2);
        margin-right: calc(-1 * var(--space-2));
        padding-bottom: var(--space-4);
    }

    .sidebar .stats {
        flex-shrink: 0;
        background: white;
        border-top: 2px solid var(--gray-200);
        margin-top: 0;
        padding-top: var(--space-4);
        padding-bottom: calc(var(--space-4) + 20px);
        position: relative;
        z-index: 2;
    }
}

@media (max-width: 768px) {
    .sidebar .filters {
        height: calc(
            100vh - var(--safe-area-top) - var(--safe-area-bottom) - 80px
        );
        height: calc(
            100dvh - var(--safe-area-top) - var(--safe-area-bottom) - 80px
        );
    }
}

/* Fix for very small screens */
@media (max-width: 480px) {
    .sidebar {
        padding-bottom: calc(250px + var(--safe-area-bottom)) !important;
    }
}
