/* Calendar Widget - Crystal Light Styles */

.w-14-2 {
    width: 14.285%;
    text-align: center;
}

/* The weekday headings are full names ("Sunday", "الأحد"), so they are sized
   to fit seven of the longest one across the drawer rather than abbreviated. */
.calendar-grid .grid-day-name {
    display: inline-block;
    font-weight: 700;
    /* Seven full names have to sit side by side: the drawer is 420px wide on a
       small screen, and 560px or more from the md breakpoint up. */
    font-size: 0.65rem;
    line-height: 1.2;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .calendar-grid .grid-day-name {
        font-size: 0.82rem;
    }
}

.calendar-grid .grid-day {
    width: 14.285%;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: var(--bs-gray-700, var(--kt-gray-700, #4B5675));
}

.calendar-grid .grid-day:hover {
    background: rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.1);
    color: var(--bs-primary, var(--kt-primary, #1b84ff));
    transform: scale(1.05);
}

.calendar-grid .grid-day.active {
    background: var(--bs-primary, var(--kt-primary, #1b84ff)) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 15px rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.3);
    font-weight: 600;
}

/* The selected day, on the filled background. This block used to set the
   number black, contradicting the white two rules above it — invisible while
   the fill itself was being dropped, and poor contrast once it drew. The
   theme already names the colour that belongs on top of primary. */
.calendar-grid .grid-day.active,
.calendar-grid .grid-day.active.today,
.calendar-grid .grid-day.active.has-event {
    background: var(--bs-primary, var(--kt-primary, #1b84ff)) !important;
    color: var(--bs-primary-inverse, var(--kt-primary-inverse, #ffffff)) !important;
    font-weight: 800 !important;
}

.calendar-grid .grid-day.today:not(.active) {
    color: var(--bs-primary, var(--kt-primary, #1b84ff));
    font-weight: 800;
}

/* Today wears a ring rather than an underscore: a 2px bar under one number
   in a grid of numbers is easy to miss, and the ring reads as "you are here"
   at a glance. Drawn on a centred pseudo-element, so it costs no layout and
   cannot nudge the grid.

   It must not be scoped to :not(.active): the widget selects today on load,
   so today's cell normally carries BOTH classes and the ring would be hidden
   in exactly the state it is most wanted. On a selected cell the ring takes
   the text colour instead, which reads against the filled background. */
.calendar-grid .grid-day.today::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    /* --kt-primary is not defined by this theme — the bundle ships
       --bs-primary — so a bare var() here made the whole border
       declaration invalid and the ring never drew. Literal fallback last,
       so the ring survives whatever the theme is called. */
    border: 2px solid var(--bs-primary, var(--kt-primary, #1b84ff));
    border-radius: 50%;
    pointer-events: none;
}

.calendar-grid .grid-day.today.active::after {
    border-color: currentColor;
}

.calendar-grid .grid-day.has-event::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    background: #FF9800;
    /* Warm orange for events */
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255, 152, 0, 0.4);
}

.calendar-grid .grid-day.active.has-event::before {
    background: #ffffff;
    box-shadow: none;
}

.calendar-grid .grid-day.other-month {
    opacity: 0.25;
}

/* Crystal Light Theme Overrides for Drawer */
#kt_drawer_calendar {
    backdrop-filter: blur(25px) saturate(180%);
    background: rgba(255, 255, 255, 0.82) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.08) !important;
}

.theme-dark-show #kt_drawer_calendar {
    background: rgba(30, 30, 45, 0.82) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -15px 0 50px rgba(0, 0, 0, 0.3) !important;
}

/* Event Cards */
.event-card {
    padding: 1.15rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 0.85rem;
    transition: all 0.3s ease;
    cursor: default;
}

.event-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.04);
    border-color: rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.15);
}

.theme-dark-show .event-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

/* Scrollbar Customization for High-Fidelity Look */
#cw_events_list::-webkit-scrollbar {
    width: 4px;
}

#cw_events_list::-webkit-scrollbar-track {
    background: transparent;
}

#cw_events_list::-webkit-scrollbar-thumb {
    background: rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.1);
    border-radius: 10px;
}

#cw_events_list:hover::-webkit-scrollbar-thumb {
    background: rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.2);
}

/* Animations */
@keyframes cw-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-card {
    animation: cw-fade-in 0.4s ease forwards;
}

.active-filter {
    background-color: var(--bs-primary, var(--kt-primary, #1b84ff)) !important;
    color: var(--bs-primary-inverse, var(--kt-primary-inverse, #ffffff)) !important;
    box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.2);
}

.cursor-pointer {
    cursor: pointer !important;
}

/* Ensure transitions are smooth */
.grid-day::before,
.grid-day::after {
    transition: all 0.2s ease;
}

#cw_today_btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#cw_today_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb, var(--kt-primary-rgb, 27, 132, 255)), 0.2);
}

#cw_type_filter_select+.select2-container--bootstrap5 .select2-selection--single {
    background-color: transparent !important;
    border: none !important;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bs-gray-700, var(--kt-gray-700, #4B5675));
}

#cw_type_filter_select+.select2-container--bootstrap5 .select2-selection__rendered {
    padding-left: 15px !important;
    padding-right: 15px !important;
    text-align: center !important;
}

/* Persistent Scrollbar for Event List */
#cw_events_list {
    overflow-y: scroll !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

#cw_events_list::-webkit-scrollbar {
    width: 5px;
    display: block !important;
}

#cw_events_list::-webkit-scrollbar-track {
    background: transparent;
}

#cw_events_list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#cw_events_list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}
/* ── Drawer: no sideways scrolling ───────────────────────────────────────────
   The drawer used to be 450px while each entry card lays out three columns
   (title, assignee, time) in a non-wrapping row, so a long title or a long
   assignee pushed the time column out of view and the body scrolled sideways.
   The drawer is wider now (see data-kt-drawer-width), the body never scrolls
   horizontally, and a card whose content still does not fit wraps its time
   column onto its own line instead of overflowing. */
#kt_drawer_calendar_body {
    overflow-x: hidden;
}
#kt_drawer_calendar .cw-card-row {
    flex-wrap: wrap;
    min-width: 0;
}
#kt_drawer_calendar .cw-card-row > div:first-child {
    flex: 1 1 220px !important;   /* title block: takes the room, but can wrap */
    min-width: 0;
}
#kt_drawer_calendar .cw-card-row > div:nth-child(2) {
    flex: 0 1 150px !important;   /* assignee */
    min-width: 0;
}
#kt_drawer_calendar .cw-card-row > div:last-child {
    flex: 0 0 auto;
    margin-inline-start: auto;
}
#kt_drawer_calendar .cw-card-desc {
    max-width: 100%;
}
#kt_drawer_calendar .event-card { min-width: 0; max-width: 100%; }
#kt_drawer_calendar .event-card > div { min-width: 0; }
#kt_drawer_calendar .cw-card-row .text-truncate { max-width: 100%; }
