/* Calendar Styling Variable & Base overrides */
:root {
    --accent-color: #720815;
    --accent-color-hover: #8C0A19; /* Slightly lighter burgundy for hover */
    --calendar-shadow: 0 10px 30px rgba(90, 58, 49, 0.08);
}

/* Section Container */
#popups-section {
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
    opacity: 0;
}

/* Grid Layout */
.calendar-layout {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 30px;
    margin-top: 20px;
    align-items: start;
}

/* Glass Card Base Styles */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--calendar-shadow);
    border: 1px solid rgba(255, 255, 255, 0.65);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(90, 58, 49, 0.12);
}

/* Calendar Card specific */
.calendar-card {
    display: flex;
    flex-direction: column;
}

/* Header with month title and arrows */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.calendar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.calendar-nav-btn {
    background: rgba(90, 58, 49, 0.04);
    border: 1px solid rgba(90, 58, 49, 0.05);
    font-size: 1.05rem;
    color: var(--primary-color);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.calendar-nav-btn:active {
    transform: scale(0.95);
}

/* Weekday columns header */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(54, 33, 24, 0.5);
    margin-bottom: 12px;
}

/* Days container grid */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    justify-items: center;
    width: 100%;
}

/* Individual day cell styling */
.calendar-day-cell {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    max-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-color);
    border: 2px solid transparent;
}

/* Hover cell effect */
.calendar-day-cell:not(.empty):not(.active):hover {
    background: rgba(90, 58, 49, 0.06);
    color: var(--primary-color);
}

/* Off-month empty days placeholder */
.calendar-day-cell.empty {
    cursor: default;
    opacity: 0;
    pointer-events: none;
}

/* Circle highlight around day containing pop-up */
.calendar-day-cell.has-popup {
    color: var(--text-color);
}

.calendar-day-cell.has-popup::after {
    content: '';
    position: absolute;
    width: 85%;
    height: 85%;
    max-width: 36px;
    max-height: 36px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(224, 122, 95, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-day-cell.has-popup:not(.active):hover::after {
    border-color: var(--accent-color-hover);
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 14px rgba(224, 122, 95, 0.4);
}



/* Current Today Highlight */
.calendar-day-cell.today:not(.active) {
    background: rgba(90, 58, 49, 0.08);
    color: var(--primary-color);
    border-color: rgba(90, 58, 49, 0.15);
}

/* Clicked Selected Active highlight */
.calendar-day-cell.active {
    background: var(--accent-color) !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.3);
}

.calendar-day-cell.active::after {
    border-color: white !important;
    box-shadow: none !important;
}



/* Main Columns layout */
.calendar-main-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.events-sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow: hidden;
}

/* On desktop, JS caps this to calendar card height so list scrolls internally */
.list-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Details Card styling */
.details-card {
    display: flex;
    flex-direction: column;
    padding: 20px !important;
}

.details-card.hidden {
    display: none !important;
}

.details-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(90, 58, 49, 0.08);
    padding-bottom: 8px;
    margin-bottom: 12px;
    gap: 15px;
}

.details-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.3;
    margin-bottom: 0px;
}

.details-close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    line-height: 1;
    transition: all 0.25s ease;
}

.details-close-btn:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.details-close-btn:active {
    transform: scale(0.9);
}

.details-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-color);
    margin-bottom: 12px;
}

.details-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-meta-item i {
    color: var(--accent-color);
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.details-meta-item a {
    text-decoration: underline;
}

.details-description {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 0px;
}

/* Placeholder card state when no day is clicked */
.details-placeholder {
    text-align: center;
    padding: 40px 10px;
    color: #777;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.details-placeholder i {
    font-size: 2.8rem;
    color: rgba(90, 58, 49, 0.15);
    animation: pulseIcon 2.5s infinite ease-in-out;
}

.details-placeholder h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.details-placeholder p {
    font-size: 0.85rem;
    max-width: 260px;
    line-height: 1.5;
    opacity: 0.8;
}

/* Event List Card (Chronological Upcoming List) */
.list-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 18px;
    padding-bottom: 0px;
    border-bottom: 1px solid rgba(90, 58, 49, 0.08);
}

.upcoming-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar customizing */
.upcoming-events-list::-webkit-scrollbar {
    width: 6px;
}
.upcoming-events-list::-webkit-scrollbar-track {
    background: rgba(90, 58, 49, 0.03);
    border-radius: 10px;
}
.upcoming-events-list::-webkit-scrollbar-thumb {
    background: rgba(90, 58, 49, 0.15);
    border-radius: 10px;
}
.upcoming-events-list::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 58, 49, 0.25);
}

/* Event list item styling */
.upcoming-event-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(90, 58, 49, 0.04);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.upcoming-event-item:hover {
    background: rgba(224, 122, 95, 0.06);
    border-color: rgba(224, 122, 95, 0.2);
    transform: translateX(4px);
}

.upcoming-event-item.active {
    background: rgba(224, 122, 95, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(224, 122, 95, 0.05);
}

/* Badge holding the event date */
.event-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--primary-gradient);
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(90, 58, 49, 0.15);
}

.event-date-badge .badge-day {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
}

.event-date-badge .badge-month {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1;
    margin-top: 3px;
}

.upcoming-event-item.active .event-date-badge {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-hover) 100%);
    box-shadow: 0 3px 8px rgba(224, 122, 95, 0.25);
}

/* Right side content of list item */
.event-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
}

.event-item-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: #666;
}

.event-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.event-item-meta i {
    color: var(--accent-color);
}

/* Animations */
@keyframes pulseIcon {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
        color: var(--accent-color);
    }
}

/* Enforce body boundaries to prevent any accidental horizontal scrollbars */
html, body {
    overflow-x: hidden !important;
}

/* Responsiveness Settings */
@media (max-width: 1023px) {
    .calendar-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 25px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .calendar-main-col, .events-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .upcoming-events-list {
        max-height: 250px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ensure the calendar section wrapper clips any overflow symmetrically */
    #popups-section {
        overflow: hidden;
    }
}

@media (max-width: 767px) {
    .glass-card {
        padding: 12px !important;
    }
    
    .calendar-header {
        margin-bottom: 12px !important;
    }

    .calendar-title {
        font-size: 1.15rem !important;
    }

    .calendar-nav-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.9rem !important;
    }

    .calendar-weekdays {
        width: 100% !important;
        margin-bottom: 6px !important;
        font-size: 0.78rem !important;
    }

    .calendar-days {
        gap: 0 !important;
    }

    .calendar-weekdays {
        gap: 0 !important;
    }

    .calendar-day-cell {
        font-size: 0.78rem !important;
        max-width: 26px !important;
    }
    
    /* Shrink list and items to fit exactly 3.5 items vertically */
    .upcoming-events-list {
        max-height: 206px !important;
        gap: 8px !important;
    }

    .upcoming-event-item {
        padding: 6px 10px !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .event-date-badge {
        width: 38px !important;
        height: 38px !important;
        border-radius: 8px !important;
    }

    .event-date-badge .badge-day {
        font-size: 0.9rem !important;
    }

    .event-date-badge .badge-month {
        font-size: 0.55rem !important;
        margin-top: 1px !important;
    }

    .event-item-info {
        min-width: 0 !important;
        flex-shrink: 1 !important;
    }

    .event-item-title {
        font-size: 0.85rem !important;
        word-break: break-all;
    }

    .event-item-meta {
        font-size: 0.7rem !important;
        flex-wrap: wrap;
        gap: 2px 6px !important;
    }

    /* Shrink details card and enforce word breaks */
    .details-card {
        padding: 15px !important;
    }

    .details-card-title {
        font-size: 1.05rem !important;
        word-break: break-word;
    }

    .details-meta-item {
        font-size: 0.82rem !important;
        gap: 6px !important;
    }

    .details-meta-item a, .details-meta-item span {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .details-description {
        font-size: 0.82rem !important;
        word-break: break-word;
    }
}

@media (max-width: 360px) {
    .glass-card {
        padding: 8px !important;
    }
    
    .calendar-days {
        gap: 2px;
    }
    
    .calendar-day-cell {
        font-size: 0.8rem;
    }
    

}
