/* ---------- Calendar Page & Views ---------- */
.fc {
    --fc-border-color: var(--em-border);
    --fc-today-bg-color: var(--em-primary-050);
    --fc-event-bg-color: var(--em-primary);
    --fc-event-border-color: var(--em-primary);
    font-size: .875rem;
}
.fc .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #22305f;
}
.fc .fc-button-primary {
    background: var(--em-surface);
    border-color: var(--em-border);
    color: #334155;
    text-transform: capitalize;
    font-weight: 600;
    box-shadow: none;
    transition: all .15s ease;
}
.fc .fc-button-primary:hover {
    background: var(--em-primary-050);
    border-color: var(--em-primary-100);
    color: var(--em-primary);
}
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--em-primary);
    border-color: var(--em-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 74, 159, .25);
}

/* Event Tones */
.fc-event {
    border-radius: 6px;
    padding: 1px 4px;
    font-weight: 600;
    font-size: .78rem;
    transition: transform .12s ease;
    cursor: pointer;
}
.fc-event:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}
.fc-event.tone-primary    { background: var(--em-primary); border-color: var(--em-primary); color: #fff; }
.fc-event.tone-info       { background: #0284c7; border-color: #0369a1; color: #fff; }
.fc-event.tone-success    { background: #10b981; border-color: #059669; color: #fff; }
.fc-event.tone-danger     { background: #ef4444; border-color: #dc2626; color: #fff; }
.fc-event.tone-warning    { background: #f59e0b; border-color: #d97706; color: #fff; }
.fc-event.tone-neutral    { background: #64748b; border-color: #475569; color: #fff; }

/* Attendance Specific Tones */
.fc-event.tone-attendance {
    background: #10b981;
    border-color: #059669;
    color: #fff;
}
.fc-event.tone-attendance.tone-warning {
    background: #f59e0b !important;
    border-color: #d97706 !important;
    color: #fff !important;
}
.fc-event.tone-attendance.tone-danger {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
}

/* Calendar Summary KPI Strip */
.calendar-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.calendar-stat {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .85rem 1rem;
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius);
    box-shadow: var(--em-shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.calendar-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 42, 68, .07);
}
.calendar-stat-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.15rem;
    background: var(--em-primary-050);
    color: var(--em-primary);
}
.calendar-stat-icon.tone-info    { background: #e0f2fe; color: #0284c7; }
.calendar-stat-icon.tone-warning { background: var(--em-warning-bg); color: var(--em-warning); }
.calendar-stat-icon.tone-success { background: #d1fae5; color: #059669; }
.calendar-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    color: #22305f;
}
.calendar-stat-label {
    display: block;
    overflow: hidden;
    font-size: .75rem;
    font-weight: 600;
    color: var(--em-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* View switcher */
.cal-view-switcher .btn {
    font-weight: 600;
    font-size: .85rem;
    padding: .45rem .85rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.cal-view-switcher .btn.active {
    background: var(--em-primary);
    color: #fff;
    border-color: var(--em-primary);
}

/* Controls bar & Sources filter (Compact chip design) */
.cal-controls-bar {
    padding: .5rem .85rem;
    border-bottom: 1px solid var(--em-border);
    background: #f8fafc;
}
.cal-source-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cal-source-wrap::-webkit-scrollbar {
    display: none;
}
.calendar-sources-chips {
    display: inline-flex;
    gap: .35rem;
    white-space: nowrap;
}
.cal-chip {
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .8125rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid var(--em-border);
    cursor: pointer;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
}
.cal-chip:hover {
    color: var(--em-primary);
    border-color: var(--em-primary-100);
    background: var(--em-primary-050);
}
.btn-check:checked + .cal-chip {
    background: var(--em-primary);
    border-color: var(--em-primary);
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(47, 60, 134, .25);
}
.btn-check:checked + .cal-chip i {
    color: #ffffff !important;
}

/* Legend dots (Super compact single-line strip) */
.calendar-legend-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: .65rem;
    padding-bottom: 2px;
}
.calendar-legend-wrap::-webkit-scrollbar {
    display: none;
}
.calendar-legend {
    display: inline-flex;
    align-items: center;
    gap: .85rem;
    font-size: .75rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    margin-bottom: 0;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: .3rem;
    vertical-align: middle;
}
.dot-task       { background: var(--em-primary); }
.dot-overdue    { background: var(--em-danger); }
.dot-exhibition { background: #0284c7; }
.dot-project    { background: #10b981; }
.dot-present    { background: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, .25); }
.dot-halfday    { background: #f59e0b; }
.dot-absent     { background: #ef4444; }

/* Bottom Report & KPI summary section */
.cal-bottom-report {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--em-border);
}

/* List view enhancements */
.fc .fc-list-day-cushion {
    background: var(--em-surface-2);
    font-weight: 700;
    color: #22305f;
    padding: .65rem 1rem;
}
.fc .fc-list-event {
    cursor: pointer;
    transition: background .12s ease;
}
.fc .fc-list-event:hover td {
    background: var(--em-primary-050) !important;
}
.fc .fc-list-event-title {
    font-weight: 700;
    color: #22305f;
}
.fc .fc-list-event-time {
    font-weight: 600;
    color: var(--em-muted);
}
.fc .fc-list-empty {
    padding: 3rem 1rem;
    color: var(--em-muted);
    font-weight: 600;
}

/* List view dot colors */
.fc .fc-list-event.tone-primary .fc-list-event-dot    { border-color: var(--em-primary) !important; }
.fc .fc-list-event.tone-info .fc-list-event-dot       { border-color: #0284c7 !important; }
.fc .fc-list-event.tone-success .fc-list-event-dot    { border-color: #10b981 !important; }
.fc .fc-list-event.tone-danger .fc-list-event-dot     { border-color: #ef4444 !important; }
.fc .fc-list-event.tone-warning .fc-list-event-dot    { border-color: #f59e0b !important; }
.fc .fc-list-event.tone-attendance .fc-list-event-dot { border-color: #10b981 !important; }

/* Event Modal Styling */
.event-info-row {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: 1px dashed var(--em-border);
}
.event-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.event-info-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: .875rem;
    background: var(--em-surface-2);
    color: var(--em-muted);
    flex: none;
}

/* Responsive Breakpoints */
@media (max-width: 767.98px) {
    .cal-page-header {
        margin-bottom: .6rem;
    }
    .cal-page-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
    }
    .cal-page-actions .cal-view-switcher {
        flex: 1 1 auto;
    }

    .cal-controls-bar {
        padding: .4rem .65rem;
    }
    .cal-chip {
        font-size: .75rem;
        padding: .25rem .6rem;
    }

    .calendar-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
    }
    .calendar-stat {
        padding: .65rem .75rem;
        gap: .5rem;
    }
    .calendar-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 10px;
    }
    .calendar-stat-value {
        font-size: 1.1rem;
    }
    .calendar-stat-label {
        font-size: .7rem;
    }

    .fc .fc-toolbar {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: .25rem !important;
        margin-bottom: .6rem !important;
        flex-wrap: nowrap !important;
    }
    .fc .fc-toolbar-chunk {
        display: flex !important;
        align-items: center !important;
        gap: .2rem !important;
        flex-wrap: nowrap !important;
    }
    .fc .fc-toolbar-title {
        font-size: .95rem !important;
        font-weight: 800 !important;
        color: #22305f !important;
        white-space: nowrap !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    .fc .fc-button {
        padding: .25rem .45rem !important;
        font-size: .75rem !important;
        line-height: 1.2 !important;
    }
    }
    .fc .fc-button {
        padding: .3rem .55rem;
        font-size: .78rem;
    }
}

@media (max-width: 575.98px) {
    .cal-controls-bar {
        padding: .4rem .5rem;
    }
    .fc .fc-daygrid-day-frame { min-height: 50px; }
    .fc .fc-daygrid-day-number { font-size: .72rem; padding: .2rem; }
    .fc .fc-daygrid-event { font-size: .65rem; padding: 1px 2px; }
    .cal-bottom-report { margin-top: .85rem; padding-top: .75rem; }
}
