/* ==========================================================================
   CALENDAR - GOOGLE CALENDAR STYLE (MOBILE-FIRST REDESIGN)
   ========================================================================== */

/* Calendar Container */
.calendar-wrapper {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Weekday Header Row */
.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #FAFAFA;
    border-bottom: 1px solid #E5E7EB;
}

.calendar-weekday {
    padding: 12px 8px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Calendar Grid - Clean, No Heavy Borders */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: white;
}

/* Calendar Day Cell */
.calendar-day {
    background: white;
    min-height: 100px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    border-right: 1px solid #F3F4F6;
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    flex-direction: column;
}

/* Remove right border on last column */
.calendar-day:nth-child(7n) {
    border-right: none;
}

/* Hover State */
.calendar-day:hover {
    background: #F9FAFB;
}

/* Today Highlight */
.calendar-day.today {
    background: #F0FDF4;
}

/* Empty cells */
.calendar-day.empty {
    background: #FAFAFA;
    cursor: default;
}

.calendar-day.empty:hover {
    background: #FAFAFA;
}

/* Date Number */
.calendar-date-number {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 4px;
    transition: all 0.2s;
}

/* Today's date number */
.calendar-day.today .calendar-date-number {
    background: #10B981;
    color: white;
    font-weight: 600;
}

/* Active/Selected State */
.calendar-day.selected .calendar-date-number {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Events Container */
.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow: hidden;
}

/* Event Item (Desktop) */
.calendar-event {
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event .material-icons {
    font-size: 14px;
}

/* Event Types (Desktop) */
.event-program {
    background: #FEF3C7;
    color: #92400E;
    border-left: 3px solid #F59E0B;
}

.event-program:hover {
    background: #FDE68A;
}

.event-attendance {
    background: #D1FAE5;
    color: #065F46;
    border-left: 3px solid #10B981;
}

.event-attendance:hover {
    background: #A7F3D0;
}

.event-off {
    background: #FEE2E2;
    color: #991B1B;
    border-left: 3px solid #EF4444;
}

.event-fund {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 3px solid #3B82F6;
}

.event-reception {
    background: #E9D5FF;
    color: #6B21A8;
    border-left: 3px solid #A855F7;
}

.event-other {
    background: #F3F4F6;
    color: #374151;
    border-left: 3px solid #9CA3AF;
}

/* ==========================================================================
   MOBILE RESPONSIVE - COMPACT TEXT BARS
   ========================================================================== */
@media (max-width: 768px) {

    /* Compact weekday header */
    .calendar-weekday {
        padding: 6px 2px;
        font-size: 0.625rem;
        /* 10px */
        font-weight: 600;
    }

    /* Day cells with fixed height */
    .calendar-day {
        min-height: 75px;
        height: 75px;
        max-height: 75px;
        padding: 3px 2px;
        vertical-align: top;
        /* Events stick to top */
        overflow: hidden;
        /* Hide overflow */
    }

    /* Smaller date number */
    .calendar-date-number {
        font-size: 0.7rem;
        /* 11.2px */
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
    }

    /* Events container - vertical stack */
    .calendar-events {
        display: flex;
        flex-direction: column;
        gap: 1px;
        margin-top: 2px;
        overflow: hidden;
        max-height: 48px;
        /* Limit to ~3 events */
    }

    /* COMPACT TEXT BARS (like real calendar apps) */
    .calendar-event {
        display: block;
        width: 100%;

        /* Typography for Mobile */
        font-size: 9px !important;
        /* Very small but readable */
        font-weight: 500;
        line-height: 1.3;
        color: #fff;
        /* White text */

        /* Create colored bar */
        border-radius: 2px;
        padding: 1px 3px;
        margin-bottom: 1px;

        /* Text truncation (CRITICAL) */
        white-space: nowrap;
        /* No line breaks */
        overflow: hidden;
        /* Hide overflow */
        text-overflow: ellipsis;
        /* Show ... */

        /* Remove desktop styles */
        border-left: none;
        gap: 0;
    }

    .calendar-event .material-icons {
        display: none;
        /* Hide icons on mobile */
    }

    /* Event type colors (solid backgrounds with white text) */
    .event-program {
        background: #F59E0B;
        /* Amber */
        color: #fff;
    }

    .event-attendance {
        background: #10B981;
        /* Green */
        color: #fff;
    }

    .event-off {
        background: #EF4444;
        /* Red */
        color: #fff;
    }

    .event-fund {
        background: #3B82F6;
        /* Blue */
        color: #fff;
    }

    .event-reception {
        background: #A855F7;
        /* Purple */
        color: #fff;
    }

    .event-other {
        background: #6B7280;
        /* Gray */
        color: #fff;
    }
}

/* Bottom Sheet for Event Details */
.event-detail-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-height: 70vh;
    overflow-y: auto;
}

.event-detail-sheet.active {
    transform: translateY(0);
}

.event-detail-sheet-handle {
    width: 40px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 2px;
    margin: 8px auto;
}

.event-detail-sheet-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.event-detail-sheet-content {
    padding: 1rem 1.5rem 2rem;
}

/* Overlay for bottom sheet */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   RESPONSIVE FIXES - MOBILE OVERFLOW SOLUTION
   ========================================================================== */

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .calendar-day {
        min-height: 90px;
    }

    .calendar-event {
        font-size: 0.7rem;
        padding: 2px 4px;
    }
}

/* Mobile (< 768px) - Overflow Fix */
@media (max-width: 767.98px) {

    /* Enable horizontal scroll */
    .calendar-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    /* Maintain 7 columns */
    .calendar-grid {
        grid-template-columns: repeat(7, minmax(50px, 1fr));
    }

    .calendar-header-row {
        grid-template-columns: repeat(7, minmax(50px, 1fr));
    }

    /* Modal full width */
    .modal-dialog,
    .fixed.z-999>div {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    /* Reduce padding */
    .content-wrapper {
        padding: 0.75rem;
    }
}

/* Extra Small Mobile (< 375px) */
@media (max-width: 374.98px) {

    .calendar-grid,
    .calendar-header-row {
        grid-template-columns: repeat(7, minmax(45px, 1fr));
    }

    .calendar-day {
        min-height: 70px;
        height: 70px;
        padding: 2px;
    }

    .calendar-date-number {
        font-size: 0.65rem;
        width: 18px;
        height: 18px;
    }

    .calendar-weekday {
        font-size: 0.5625rem;
        /* 9px */
        padding: 4px 1px;
    }

    .calendar-event {
        font-size: 8px !important;
        padding: 1px 2px;
    }
}

/* Landscape Mobile */
@media (max-height: 667px) and (orientation: landscape) {
    .calendar-day {
        min-height: 60px;
        height: 60px;
    }

    .event-detail-sheet {
        max-height: 60vh;
    }
}