/* Events Tablet Styles (768px - 1199px) */
:root {
    --bg-light: #fdfcfb;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-gold: #cba174;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-family: 'Noto Sans SC', sans-serif;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* Hero Section */
.events-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 160px 0 80px;
    text-align: center;
    position: relative;
    color: white;
}

.events-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    margin-bottom: 20px;
    font-weight: 700;
    color: white;
}

.events-hero p {
    font-size: 1.1rem;
    color: #cbd5e1;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.events-hero .container {
    margin: 0 !important;
    width: auto !important;
    padding: 0 40px;
}

/* Main Container - Tablet Stacked or 2 Col Logic */
.main-container {
    display: flex;
    flex-direction: column;
    /* Stack sidebar on tablet usually better, or top filter */
    gap: 40px;
    padding: 40px 30px 80px;
    margin: 0 auto;
    width: 100%;
}

/* If wide tablet, maybe maintain sidebar? 
   Original CSS had grid-template-columns: 280px 1fr;
   But media query @ 900px switched to 1fr.
   So 768-900 is stacked. 900-1199 is sidebar.
   Let's keep sidebar for >=900 (Large Tablet) and stack for <900.
*/

@media (min-width: 1020px) {
    .main-container {
        display: grid;
        grid-template-columns: 260px 1fr;
    }
}

/* Sidebar */
.filter-sidebar {
    position: sticky;
    top: 150px;
    height: fit-content;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    box-shadow: var(--card-shadow);
}

.filter-group-title {
    font-family: 'Playfair Display', serif;
    /* Premium Font */
    font-size: 1.25rem;
    /* Larger font */
    text-transform: uppercase;
    letter-spacing: 1px;
    /* More spacing */
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--accent-gold);
    /* Underline for atmosphere */
    padding-bottom: 12px;
}

#resetDateBtn {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    border-radius: 4px;
    transition: all 0.3s ease;
}

#resetDateBtn:hover {
    background: var(--accent-gold) !important;
    color: white !important;
    box-shadow: 0 4px 6px rgba(203, 161, 116, 0.25);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* If stacked on smaller tablet, horizontal filters */
@media (max-width: 1019px) {
    .filter-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .filter-group {
        flex: 1;
        min-width: 200px;
    }

    .filter-options {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.filter-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
    text-align: left;
    display: flex;
    justify-content: space-between;
}

.filter-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(203, 161, 116, 0.1);
    color: #b48a5f;
    border: 1px solid rgba(203, 161, 116, 0.3);
    font-weight: 600;
}

.filter-btn.active::after {
    content: '✓';
}

/* Events Grid - Tablet Responsive Cols */
.events-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Default 3 cols for large tablet */
    gap: 20px;
}

@media (max-width: 1019px) {
    .events-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 cols for small tablet */
    }
}

/* Event Card */
.event-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--card-shadow);
    text-decoration: none;
    color: inherit;
}

.event-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent-gold);
}

.card-header {
    height: 140px;
    background: #1e293b;
    position: relative;
    overflow: hidden;
}

.card-type-tag {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.type-academic .card-header {
    background: linear-gradient(135deg, #1e3a8a, #172554);
}

.type-expo .card-header {
    background: linear-gradient(135deg, #9a3412, #7c2d12);
}

.date-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    text-align: center;
    border-top-right-radius: 8px;
}

.date-badge .month {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.date-badge .day {
    display: block;
    font-size: 1.8rem;
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
    line-height: 1;
    font-weight: 700;
}

.card-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-meta span {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
}

.card-detail {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.btn-link {
    color: #b48a5f;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.2s;
}

.btn-link:hover {
    gap: 10px;
    color: #8c6b4a;
}

/* Flatpickr */
.flatpickr-calendar.inline {
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
}

.flatpickr-months {
    padding: 0 0 10px !important;
}

.flatpickr-current-month input.cur-year {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: #cbd5e1 !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--accent-gold) !important;
}

/* Month Selection Grid */
.flatpickr-monthSelect-months {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    padding: 10px 0 !important;
    width: 100% !important;
    margin: 0 !important;
}

.flatpickr-monthSelect-month {
    position: relative !important;
    width: auto !important;
    height: 36px !important;
    line-height: 36px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 1px solid #e2e8f0 !important;
    color: var(--text-secondary) !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    transition: all 0.2s !important;
}

.flatpickr-monthSelect-month:hover {
    border-color: var(--accent-gold) !important;
    color: var(--text-primary) !important;
    background: #fffcf8 !important;
    cursor: pointer;
}

.flatpickr-monthSelect-month.selected {
    background: var(--accent-gold) !important;
    color: white !important;
    border-color: var(--accent-gold) !important;
    font-weight: 600 !important;
}

.no-results {
    grid-column: 1 / -1;
    padding: 50px;
    text-align: center;
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: none;
}

/* Hide Year Spinners */
.flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-current-month .numInputWrapper span.arrowDown {
    display: none !important;
}

.flatpickr-current-month .numInputWrapper:hover {
    background: transparent !important;
}

.flatpickr-current-month .numInputWrapper input.cur-year {
    padding: 0 !important;
}

/* Floating Filter Button (Creative Enhanced) */
.filter-trigger {
    display: none;
    /* Hidden by default (for wide tablet), shown in media query below */
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #1e293b;
    padding: 14px 28px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    font-weight: 600;
    font-size: 1rem;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Gradient Border/Glow Effect */
.filter-trigger::before {
    content: '';
    position: absolute;
    inset: -2px;
    z-index: -1;
    background: linear-gradient(45deg, var(--accent-gold), transparent, var(--accent-gold));
    border-radius: 50px;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.filter-trigger:hover {
    transform: translateX(-50%) translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(203, 161, 116, 0.25);
    color: #0f172a;
}

.filter-trigger:hover::before {
    opacity: 0.6;
}

.filter-trigger svg {
    display: block;
    transition: transform 0.3s;
}

.filter-trigger:hover svg {
    transform: rotate(90deg);
}

.filter-trigger:active {
    transform: translateX(-50%) scale(0.95);
}

.filter-trigger.hide-trigger {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

/* Sidebar Modal Styles (Left Slide & Desktop Layout) */
@media (max-width: 1019px) {
    .filter-trigger {
        display: flex;
    }

    .main-container {
        display: block !important;
        /* Stacked layout */
    }

    /* Left Slide Sidebar */
    .filter-sidebar {
        display: block;
        position: fixed;
        top: 140px !important;
        /* Adjusted to 140px */
        left: 0;
        bottom: 0;
        width: 320px;
        height: calc(100vh - 140px) !important;
        /* Remaining height */

        /* Premium Glassmorphism */
        background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%) !important;
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);

        z-index: 10000 !important;
        /* MAX Z-Index */
        padding: 30px 25px 40px !important;
        overflow-y: auto;
        border-radius: 0 16px 16px 0;

        /* Deep Shadow & Subtle Inner Light */
        box-shadow: 20px 0 50px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.4);
        border-left: none;

        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        max-width: none;
    }

    /* Artist Center Calendar */
    .filter-sidebar .flatpickr-calendar {
        margin: 0 auto 25px auto !important;
        position: static !important;
        /* Override absolute positioning */
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
        background: rgba(255, 255, 255, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(10px);
        border-radius: 16px !important;
        width: 280px !important;
    }

    /* Fix Internal Month Grid Alignment */
    .filter-sidebar .flatpickr-monthSelect-months {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        padding: 5px !important;
    }

    .filter-sidebar .flatpickr-monthSelect-month {
        flex: 0 0 30% !important;
        /* 3 per row perfectly */
        margin: 1.5% !important;
        height: 40px !important;
        line-height: 40px !important;
        border-radius: 8px !important;
    }

    .filter-sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header-mobile {
        position: absolute;
        top: 30px;
        right: 25px;
        left: 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 0;
        border: none;
        z-index: 10;
    }

    .sidebar-header-mobile h3 {
        margin: 0;
        font-size: 1.25rem;
        color: #0f172a;
        font-weight: 700;
        font-family: 'Playfair Display', serif;
    }

    .close-filter {
        background: #f1f5f9;
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        color: #64748b;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        line-height: 1;
        transition: all 0.2s;
    }

    .close-filter:hover {
        background: #e2e8f0;
        color: #0f172a;
    }

    /* Restore Grid/Flow Layout for Options (Match Desktop) */
    .filter-sidebar .filter-options {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .filter-sidebar .filter-btn {
        width: 100% !important;
        height: 44px !important;
        flex: none !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        font-size: 0.9rem;
        color: #475569;
        padding: 0 10px;
    }

    .filter-sidebar .filter-btn:hover {
        background: #fff;
        border-color: #cbd5e1;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }

    .filter-sidebar .filter-btn.active {
        background: #fffcf8;
        border-color: var(--accent-gold);
        color: var(--accent-gold);
        font-weight: 600;
        box-shadow: 0 0 0 1px var(--accent-gold) inset;
    }
}

/* Overlay */
.filter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 2050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.filter-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Hide header on >= 900px */
.sidebar-header-mobile {
    display: none;
}