/**
 * assets/css/chat_page/calendar.css
 *
 * Orchid-inspired visual styling for AbraCollab Calendar & Scheduling.
 * Integrates with AbraCollab color variables, dark/light modes, and responsive breakpoints.
 */

.calendar_middle_view {
    height: 100%;
    width: 100%;
    overflow-y: auto;
    background: var(--bg-body, #f8fafc);
    color: var(--text-color, #1e293b);
    display: flex;
    flex-direction: column;
}

body.dark_mode .calendar_middle_view {
    background: #0f172a;
    color: #f1f5f9;
}

.cal-page-wrapper {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

@media (max-width: 768px) {
    .cal-page-wrapper {
        padding: 16px;
    }
}

/* ── Header Bar ── */
.cal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.cal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.cal-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted, #64748b);
    margin: 4px 0 0 0;
}

.cal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Calendar Module in Column 1 (Aside) ── */
/* ── Calendar Module in Column 1 (Aside) ── */
.calendar_management_module {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

body.dark_mode .calendar_management_module {
    background: #0b0f19 !important;
    color: #e2e8f0 !important;
}

body.light_mode .calendar_management_module {
    background: #ffffff !important;
    color: #334155 !important;
}

/* Titlebar */
.calendar_management_module .cal_aside_record {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 18px 14px 18px !important;
    min-height: 48px !important;
    border-bottom: none !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

body.dark_mode .calendar_management_module .cal_aside_record {
    background: #0b0f19 !important;
}

body.light_mode .calendar_management_module .cal_aside_record {
    background: #ffffff !important;
}

.calendar_management_module .cal_aside_record > .title {
    display: inline-flex !important;
    align-items: center !important;
    max-width: 60% !important;
    margin-right: auto !important;
    height: auto !important;
}

.calendar_management_module .cal_aside_record > .title > .title_inner {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 0 !important;
    cursor: default !important;
}

.calendar_management_module .cal_aside_record .cal_title_icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    flex-shrink: 0 !important;
    color: #6366f1 !important;
}

.calendar_management_module .cal_aside_record .cal_title_icon i {
    font-size: 20px !important;
    line-height: 1 !important;
    color: #6366f1 !important;
    display: block !important;
}

.calendar_management_module .cal_aside_record > .title .text {
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    line-height: 1.2 !important;
}

body.dark_mode .calendar_management_module .cal_aside_record > .title .text {
    color: #ffffff !important;
}

body.light_mode .calendar_management_module .cal_aside_record > .title .text {
    color: #0f172a !important;
}

/* Action Buttons */
.calendar_management_module .cal_aside_record .comm_header_actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: auto !important;
}

.calendar_management_module .cal_aside_record .aside_btn_icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    outline: none !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.calendar_management_module .cal_aside_record .aside_btn_icon svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    pointer-events: none !important;
}

body.dark_mode .calendar_management_module .cal_aside_record .aside_btn_icon:disabled,
body.dark_mode .calendar_management_module .cal_aside_record .aside_btn_icon.disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #64748b !important;
    box-shadow: none !important;
}

body.light_mode .calendar_management_module .cal_aside_record .aside_btn_icon:disabled,
body.light_mode .calendar_management_module .cal_aside_record .aside_btn_icon.disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #94a3b8 !important;
    box-shadow: none !important;
}

/* Search Bar */
.calendar_management_module .cal_aside_search {
    padding: 0 14px !important;
    margin: 0 0 14px 0 !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    position: relative !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    flex: 0 0 38px !important;
    box-sizing: border-box !important;
}

.calendar_management_module .cal_aside_search > i.notes_search_icon,
.calendar_management_module .cal_aside_search > i {
    position: absolute !important;
    left: 26px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    pointer-events: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    z-index: 2 !important;
}

body.dark_mode .calendar_management_module .cal_aside_search > i.notes_search_icon,
body.dark_mode .calendar_management_module .cal_aside_search > i {
    color: #64748b !important;
}

body.light_mode .calendar_management_module .cal_aside_search > i.notes_search_icon,
body.light_mode .calendar_management_module .cal_aside_search > i {
    color: #94a3b8 !important;
}

.calendar_management_module .cal_aside_search > input {
    outline: none !important;
    width: 100% !important;
    height: 38px !important;
    border-radius: 8px !important;
    padding: 8px 12px 8px 34px !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    display: block !important;
}

body.dark_mode .calendar_management_module .cal_aside_search > input {
    background: #151d30 !important;
    border: 1px solid #1e293b !important;
    color: #ffffff !important;
}

body.dark_mode .calendar_management_module .cal_aside_search > input::placeholder {
    color: #64748b !important;
}

body.dark_mode .calendar_management_module .cal_aside_search > input:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3) !important;
    background: #1b253d !important;
}

body.light_mode .calendar_management_module .cal_aside_search > input {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

body.light_mode .calendar_management_module .cal_aside_search > input::placeholder {
    color: #94a3b8 !important;
}

body.light_mode .calendar_management_module .cal_aside_search > input:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
    background: #ffffff !important;
}

.cal_aside_body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 0 14px 70px 14px !important;
    box-sizing: border-box !important;
    scrollbar-width: thin !important;
}

.cal_sidebar_slot,
.cal_mobile_slot {
    width: 100%;
}

.cal_dock_tools {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10;
}

/* ── Calendar Middle View Layout Container ── */
.cal-layout-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
    align-items: stretch;
}

/* ── FIRST DIV: Sidebar ── */
.cal-sidebar-div {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cal-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark_mode .cal-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: none;
}

.cal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cal-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
}

.cal-badge-pill {
    background: var(--primary-light, #e0e7ff);
    color: var(--primary, #4f46e5);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

body.dark_mode .cal-badge-pill {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* ── Mini Calendar ── */
.cal-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    font-size: 0.8rem;
}

.cal-mini-head {
    font-weight: 600;
    color: var(--text-muted, #64748b);
    padding: 4px 0;
}

.cal-mini-day {
    padding: 6px 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s ease;
    position: relative;
}

.cal-mini-day:hover {
    background: var(--bg-hover, #f1f5f9);
}

body.dark_mode .cal-mini-day:hover {
    background: #334155;
}

.cal-mini-day.is-today {
    color: var(--primary, #4f46e5);
    font-weight: 700;
    background: var(--primary-light, #eef2ff);
}

body.dark_mode .cal-mini-day.is-today {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.cal-mini-day.is-selected {
    background: var(--primary, #4f46e5) !important;
    color: #ffffff !important;
}

.cal-mini-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary, #4f46e5);
    border-radius: 50%;
}

.cal-mini-day.is-other {
    opacity: 0.35;
}

.btn-icon-sm {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-muted, #64748b);
}

.btn-icon-sm:hover {
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-color, #1e293b);
}

body.dark_mode .btn-icon-sm {
    color: #94a3b8;
}

body.dark_mode .btn-icon-sm:hover {
    background: #334155;
    color: #f1f5f9;
}

/* ── Today & Upcoming Agenda Lists ── */
.cal-agenda-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.cal-side-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-body, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    cursor: pointer;
    transition: all 0.15s ease;
}

body.dark_mode .cal-side-item {
    background: #0f172a;
    border-color: #334155;
}

.cal-side-item:hover {
    border-color: var(--primary, #4f46e5);
    transform: translateY(-1px);
}

.cal-side-bar {
    width: 4px;
    height: 100%;
    min-height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cal-side-meta {
    flex: 1;
    min-width: 0;
}

.cal-side-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-side-time {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
}

.cal-empty-text {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
    margin: 0;
    padding: 8px 0;
    text-align: center;
}

/* ── SECOND DIV: Main Calendar ── */
.cal-main-div {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.dark_mode .cal-main-div {
    background: #1e293b;
    border-color: #334155;
}

/* ── Toolbar ── */
.cal-toolbar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    gap: 14px;
    flex-wrap: wrap;
}

body.dark_mode .cal-toolbar {
    border-color: #334155;
}

.cal-nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-nav-group .cal-nav-btn,
.cal-nav-group [data-cal-prev],
.cal-nav-group [data-cal-next] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    color: var(--text-color, #1e293b);
    border: 1px solid var(--border-color, #cbd5e1);
    background: var(--bg-body, #f8fafc);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-nav-group .cal-nav-btn:hover,
.cal-nav-group [data-cal-prev]:hover,
.cal-nav-group [data-cal-next]:hover {
    background: var(--bg-hover, #f1f5f9);
    border-color: var(--primary, #6366f1);
    color: var(--primary, #6366f1);
}

body.dark_mode .cal-nav-group .cal-nav-btn,
body.dark_mode .cal-nav-group [data-cal-prev],
body.dark_mode .cal-nav-group [data-cal-next] {
    color: #cbd5e1;
    border-color: #475569;
    background: #0f172a;
}

body.dark_mode .cal-nav-group .cal-nav-btn:hover,
body.dark_mode .cal-nav-group [data-cal-prev]:hover,
body.dark_mode .cal-nav-group [data-cal-next]:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: #818cf8;
    color: #818cf8;
}

.cal-current-label {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    min-width: 140px;
    text-align: center;
}

.cal-toolbar-center {
    flex: 1;
    max-width: 300px;
}

.cal-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.cal-search-wrap i {
    position: absolute;
    left: 10px;
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
}

.cal-search-input {
    width: 100%;
    padding: 6px 12px 6px 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.85rem;
    outline: none;
    background: var(--bg-body, #f8fafc);
    color: inherit;
}

body.dark_mode .cal-search-input {
    background: #0f172a;
    border-color: #334155;
}

.cal-search-input:focus {
    border-color: var(--primary, #4f46e5);
}

.cal-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
}

/* ── Category Legend Chips ── */
.cal-legend-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    overflow-x: auto;
}

body.dark_mode .cal-legend-bar {
    border-color: #334155;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-body, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-color, #1e293b);
    white-space: nowrap;
}

body.dark_mode .legend-chip {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.legend-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-chip:hover, .legend-chip.active {
    background: var(--primary-light, #e0e7ff);
    border-color: var(--primary, #4f46e5);
    color: var(--primary, #4f46e5);
}

body.dark_mode .legend-chip:hover, body.dark_mode .legend-chip.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

/* ── Day & Week Time Grid ── */
.cal-view-viewport {
    flex: 1;
    overflow-y: auto;
    position: relative;
    max-height: calc(100vh - 280px);
    min-height: 520px;
}

.cal-time-grid {
    display: grid;
    position: relative;
}

.cal-time-grid--day {
    grid-template-columns: 70px 1fr;
}

.cal-time-grid--week {
    grid-template-columns: 70px repeat(7, 1fr);
}

.cal-time-head {
    padding: 10px 8px;
    font-weight: 700;
    font-size: 0.82rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    background: var(--bg-body, #f8fafc);
    color: var(--text-color, #1e293b);
    position: sticky;
    top: 0;
    z-index: 5;
}

body.dark_mode .cal-time-head {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.cal-time-slot {
    padding: 12px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-align: right;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    height: 54px;
    box-sizing: border-box;
}

body.dark_mode .cal-time-slot {
    border-color: #334155;
}

.cal-day-slot {
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    border-left: 1px solid var(--border-color, #e2e8f0);
    height: 54px;
    position: relative;
    cursor: pointer;
    transition: background 0.1s ease;
}

body.dark_mode .cal-day-slot {
    border-color: #334155;
}

.cal-day-slot:hover {
    background: rgba(99, 102, 241, 0.04);
}

.cal-day-slot.cal-drop-hover {
    background: rgba(99, 102, 241, 0.16) !important;
    outline: 2px dashed #6366f1 !important;
    outline-offset: -2px;
}

body.dark_mode .cal-day-slot.cal-drop-hover {
    background: rgba(99, 102, 241, 0.28) !important;
    outline-color: #818cf8 !important;
}

/* ── Positioned Event Cards on Day/Week Grid ── */
.cal-time-event {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    cursor: grab;
    overflow: hidden;
    z-index: 2;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    user-select: none;
    line-height: 1.25;
}

.cal-time-event:active {
    cursor: grabbing;
}

.cal-time-event.is-dragging {
    opacity: 0.45;
    transform: scale(0.96);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.cal-time-event:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.cal-time-event .evt-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: inherit;
}

.cal-time-event .evt-title i {
    flex-shrink: 0;
    font-size: 0.82rem;
    color: inherit;
}

.cal-time-event .evt-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    font-weight: 600;
}

.cal-time-event .evt-time {
    font-size: 0.72rem;
    opacity: 0.95;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    flex-shrink: 0;
    color: inherit;
}

.cal-time-event .evt-time-inline {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.95;
    white-space: nowrap;
    margin-left: 6px;
    flex-shrink: 0;
    color: inherit;
}

/* Explicit high-contrast text styling for light / focus blocks */
.cal-time-event.cal-text-dark,
.cal-time-event[data-event-type="FOCUS"] {
    color: #0f172a !important;
}

.cal-time-event.cal-text-dark .evt-title,
.cal-time-event.cal-text-dark .evt-title-text,
.cal-time-event.cal-text-dark .evt-title i,
.cal-time-event.cal-text-dark .evt-time,
.cal-time-event.cal-text-dark .evt-time-inline,
.cal-time-event[data-event-type="FOCUS"] .evt-title,
.cal-time-event[data-event-type="FOCUS"] .evt-title-text,
.cal-time-event[data-event-type="FOCUS"] .evt-title i,
.cal-time-event[data-event-type="FOCUS"] .evt-time,
.cal-time-event[data-event-type="FOCUS"] .evt-time-inline {
    color: #0f172a !important;
}

.cal-time-event.cal-text-dark .task-tag,
.cal-time-event[data-event-type="FOCUS"] .task-tag {
    background: rgba(15, 23, 42, 0.15) !important;
    color: #0f172a !important;
}

.cal-event-chip.cal-text-dark,
.cal-event-chip[data-event-type="FOCUS"],
.cal-event-chip.focus-block {
    color: #0f172a !important;
    font-weight: 600;
}

/* Explicit high-contrast white text styling for colored event blocks (Meetings, Deadlines, Company, Tasks, etc.) */
.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]),
.cal-time-event[data-event-type="MEETING"],
.cal-time-event[data-event-type="DEADLINE"],
.cal-time-event[data-event-type="COMPANY"],
.cal-time-event[data-event-type="TASK"] {
    color: #ffffff !important;
}

.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]) .evt-title,
.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]) .evt-title-text,
.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]) .evt-title i,
.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]) .evt-time,
.cal-time-event:not(.cal-text-dark):not([data-event-type="FOCUS"]) .evt-time-inline,
.cal-time-event[data-event-type="MEETING"] .evt-title,
.cal-time-event[data-event-type="MEETING"] .evt-title-text,
.cal-time-event[data-event-type="MEETING"] .evt-title i,
.cal-time-event[data-event-type="MEETING"] .evt-time,
.cal-time-event[data-event-type="MEETING"] .evt-time-inline,
.cal-time-event[data-event-type="DEADLINE"] .evt-title,
.cal-time-event[data-event-type="DEADLINE"] .evt-title-text,
.cal-time-event[data-event-type="DEADLINE"] .evt-title i,
.cal-time-event[data-event-type="DEADLINE"] .evt-time,
.cal-time-event[data-event-type="DEADLINE"] .evt-time-inline,
.cal-time-event[data-event-type="COMPANY"] .evt-title,
.cal-time-event[data-event-type="COMPANY"] .evt-title-text,
.cal-time-event[data-event-type="COMPANY"] .evt-title i,
.cal-time-event[data-event-type="COMPANY"] .evt-time,
.cal-time-event[data-event-type="COMPANY"] .evt-time-inline,
.cal-time-event[data-event-type="TASK"] .evt-title,
.cal-time-event[data-event-type="TASK"] .evt-title-text,
.cal-time-event[data-event-type="TASK"] .evt-title i,
.cal-time-event[data-event-type="TASK"] .evt-time,
.cal-time-event[data-event-type="TASK"] .evt-time-inline {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.cal-event-chip:not(.cal-text-dark):not([data-event-type="FOCUS"]) {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.cal-time-event.cal-event-compact {
    padding: 2px 8px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
}

.cal-time-event.cal-event-compact .evt-title {
    flex: 1 1 auto;
}

.cal-time-event .task-tag {
    font-size: 0.68rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 5px;
    border-radius: 4px;
    width: fit-content;
}

/* ── Month Grid View ── */
.cal-month-container {
    display: flex;
    flex-direction: column;
}

.cal-month-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-body, #f8fafc);
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    padding: 8px 0;
}

body.dark_mode .cal-month-head {
    background: #0f172a;
    border-color: #334155;
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(90px, 1fr);
}

.cal-cell {
    border-right: 1px solid var(--border-color, #e2e8f0);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    min-height: 90px;
    transition: background 0.1s ease;
}

body.dark_mode .cal-cell {
    border-color: #334155;
}

.cal-cell:hover {
    background: rgba(99, 102, 241, 0.04);
}

.cal-cell.is-other-month {
    opacity: 0.4;
    background: var(--bg-body, #f8fafc);
}

body.dark_mode .cal-cell.is-other-month {
    background: #0f172a;
}

.cal-cell__date {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.cal-cell.is-today .cal-cell__date {
    background: var(--primary, #4f46e5);
    color: #ffffff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-event-chip {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-more {
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    font-weight: 600;
}

/* ── Sched Links & AI Modal List ── */
.cal-sched-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cal-sched-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-body, #f8fafc);
}

body.dark_mode .cal-sched-item {
    background: #0f172a;
    border-color: #334155;
}

.cal-ai-slot-card {
    background: var(--primary-light, #eef2ff);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1e293b;
}

.cal-ai-slot-card .cal-ai-slot-time,
.cal-ai-slot-card .text-muted {
    color: #475569 !important;
    font-size: 0.85rem;
}

body.dark_mode .cal-ai-slot-card {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #f1f5f9;
}

body.dark_mode .cal-ai-slot-card .cal-ai-slot-time,
body.dark_mode .cal-ai-slot-card .text-muted {
    color: #cbd5e1 !important;
}

#calAiModal .text-muted,
.cal-ai-results .text-muted {
    color: #64748b !important;
}

body.dark_mode #calAiModal .text-muted,
body.dark_mode .cal-ai-results .text-muted {
    color: #94a3b8 !important;
}

/* ── Calendar Modals & Stacking Context ── */
#calEventModal, #calAiModal, #calSchedModal, #calGcalModal, #calOutlookModal {
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

body.dark_mode #calEventModal .modal-content,
body.dark_mode #calAiModal .modal-content,
body.dark_mode #calSchedModal .modal-content,
body.dark_mode #calGcalModal .modal-content,
body.dark_mode #calOutlookModal .modal-content {
    background-color: #121b2d !important;
    color: #f1f5f9;
    border: 1px solid #24334a;
    border-radius: 12px;
}

body.dark_mode #calEventModal .modal-header,
body.dark_mode #calEventModal .modal-footer,
body.dark_mode #calAiModal .modal-header,
body.dark_mode #calSchedModal .modal-header,
body.dark_mode #calGcalModal .modal-header,
body.dark_mode #calOutlookModal .modal-header {
    border-color: #24334a;
}

body.dark_mode #calEventModal .form-control,
body.dark_mode #calEventModal .form-select,
body.dark_mode #calAiModal .form-control,
body.dark_mode #calSchedModal .form-control,
body.dark_mode #calSchedModal .form-select,
body.dark_mode #calGcalModal .form-control,
body.dark_mode #calOutlookModal .form-control {
    background-color: #0b1120 !important;
    border-color: #24334a !important;
    color: #f8fafc !important;
    border-radius: 8px;
}

body.dark_mode #calEventModal .form-control::placeholder,
body.dark_mode #calAiModal .form-control::placeholder,
body.dark_mode #calSchedModal .form-control::placeholder,
body.dark_mode #calGcalModal .form-control::placeholder,
body.dark_mode #calOutlookModal .form-control::placeholder {
    color: #64748b;
    opacity: 0.8;
}

body.dark_mode #calEventModal .form-control:focus,
body.dark_mode #calEventModal .form-select:focus,
body.dark_mode #calAiModal .form-control:focus,
body.dark_mode #calSchedModal .form-control:focus,
body.dark_mode #calSchedModal .form-select:focus,
body.dark_mode #calGcalModal .form-control:focus,
body.dark_mode #calOutlookModal .form-control:focus {
    background-color: #0b1120 !important;
    border-color: #6366f1 !important;
    color: #f8fafc !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
}

body.dark_mode #calEventModal .form-label,
body.dark_mode #calAiModal .form-label,
body.dark_mode #calSchedModal .form-label,
body.dark_mode #calGcalModal .form-label,
body.dark_mode #calOutlookModal .form-label {
    color: #cbd5e1;
}

body.dark_mode #calEventModal .btn-close,
body.dark_mode #calAiModal .btn-close,
body.dark_mode #calSchedModal .btn-close,
body.dark_mode #calGcalModal .btn-close,
body.dark_mode #calOutlookModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ── Scheduling Links Styling ── */
.cal-sched-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cal-sched-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--card-bg, #ffffff);
    gap: 12px;
}

body.dark_mode .cal-sched-item {
    background: #0f172a;
    border-color: #24334a;
}

.cal-sched-new-form,
#calSchedNewFormWrap {
    background: #f8fafc;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

body.dark_mode .cal-sched-new-form,
body.dark_mode #calSchedNewFormWrap {
    background: #0f172a !important;
    border-color: #24334a !important;
    color: #f1f5f9 !important;
}

body.dark_mode #calSchedNewFormWrap .border-bottom {
    border-color: #24334a !important;
}

body.dark_mode #calSchedNewFormWrap h6 {
    color: #f8fafc !important;
}

body.dark_mode #calSchedNewFormWrap .form-label {
    color: #cbd5e1 !important;
}

body.dark_mode #calSchedNewFormWrap .text-muted {
    color: #94a3b8 !important;
}

.cal-modal-subtext {
    color: #64748b;
    font-size: 0.85rem;
}

body.dark_mode .cal-modal-subtext,
body.dark_mode #calSchedModal .modal-body > .d-flex p,
body.dark_mode #calSchedModal .text-muted,
body.dark_mode #calGcalModal .text-muted,
body.dark_mode #calEventModal .text-muted,
body.dark_mode #calAiModal .text-muted,
body.dark_mode #calOutlookModal .text-muted {
    color: #cbd5e1 !important;
}

body.dark_mode #calOutlookConnectSection,
body.dark_mode #calGcalConnectSection {
    color: #cbd5e1 !important;
}

body.dark_mode #calOutlookConnectSection p,
body.dark_mode #calGcalConnectSection p,
body.dark_mode #calOutlookConnectSection label,
body.dark_mode #calGcalConnectSection label,
body.dark_mode #calOutlookConnectSection .form-text,
body.dark_mode #calGcalConnectSection .form-text,
body.dark_mode #calOutlookConnectSection a,
body.dark_mode #calGcalConnectSection a {
    color: #cbd5e1 !important;
}

body.dark_mode #calOutlookConnectSection a:hover,
body.dark_mode #calGcalConnectSection a:hover {
    color: #ffffff !important;
}

body.dark_mode #calOutlookConnectSection .border-top,
body.dark_mode #calGcalConnectSection .border-top {
    border-color: #24334a !important;
}

body.dark_mode #calOutlookStatusBanner,
body.dark_mode #calGcalStatusBanner {
    background-color: #0b1120 !important;
    border-color: #24334a !important;
    color: #f1f5f9 !important;
}

body.dark_mode #calOutlookStatusBanner #calOutlookStatusText,
body.dark_mode #calGcalStatusBanner #calGcalStatusText {
    color: #f1f5f9 !important;
}

body.dark_mode #calOutlookStatusBanner #calOutlookSyncTime,
body.dark_mode #calGcalStatusBanner #calGcalSyncTime {
    color: #94a3b8 !important;
}

/* ── Mobile View Layout in Aside (Column First) ── */
@media (max-width: 770.98px) {
    .calendar_management_module .cal_mobile_slot {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .calendar_management_module .cal_mobile_slot .cal-header-bar {
        padding: 0 0 8px 0;
    }

    .calendar_management_module .cal_mobile_slot .cal-header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .calendar_management_module .cal_mobile_slot .cal-header-actions .btn {
        flex: 1 1 auto;
        font-size: 0.8rem;
        padding: 6px 8px;
    }

    .calendar_management_module .cal_mobile_slot .cal-main-div {
        width: 100%;
    }

    .calendar_management_module .cal_mobile_slot .cal-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .calendar_management_module .cal_mobile_slot .cal-nav-group {
        justify-content: space-between;
        width: 100%;
    }

    .calendar_management_module .cal_mobile_slot .cal-toolbar-right {
        justify-content: center;
        width: 100%;
    }
}

/* ── Calendar Event Video Meeting Links ── */
.cal-evt-meet-wrap {
    margin-top: 4px;
    display: block;
}

.cal-evt-meet-link {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff !important;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    text-decoration: none !important;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease, transform 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.cal-text-dark .cal-evt-meet-link,
[data-event-type="FOCUS"] .cal-evt-meet-link {
    background: rgba(15, 23, 42, 0.15);
    border: 1px solid rgba(15, 23, 42, 0.28);
    color: #0f172a !important;
}

.cal-evt-meet-link:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.cal-text-dark .cal-evt-meet-link:hover,
[data-event-type="FOCUS"] .cal-evt-meet-link:hover {
    background: rgba(15, 23, 42, 0.25);
    color: #0f172a !important;
}

.cal-evt-meet-link-compact {
    font-size: 0.68rem;
    padding: 1px 6px;
    line-height: 1.2;
}

.cal-side-meet-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4f46e5 !important;
    text-decoration: none !important;
    background: rgba(79, 70, 229, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.cal-side-meet-link:hover {
    background: rgba(79, 70, 229, 0.2);
    text-decoration: underline !important;
}

body.dark_mode .cal-side-meet-link {
    color: #818cf8 !important;
    background: rgba(129, 140, 248, 0.15);
}

body.dark_mode .cal-side-meet-link:hover {
    background: rgba(129, 140, 248, 0.25);
}

/* Meeting Link Box in Modal */
#calMeetingLinkBox {
    border-radius: 8px;
}

#calMeetingLinkBox a#calEvtMeetingAnchor {
    word-break: break-all;
    font-size: 0.85rem;
}

body.dark_mode #calMeetingLinkBox {
    background-color: rgba(79, 70, 229, 0.15) !important;
    border-color: rgba(79, 70, 229, 0.35) !important;
    color: #e0e7ff !important;
}

body.dark_mode #calMeetingLinkBox a#calEvtMeetingAnchor {
    color: #a5b4fc !important;
}

body.dark_mode #calMeetingLinkBox .btn-outline-primary {
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.4);
}

body.dark_mode #calMeetingLinkBox .btn-outline-primary:hover {
    background-color: #4f46e5;
    color: #ffffff;
}



