/* =========================================================
 * 1. CCF CALENDAR WRAPPER & HEADER
 * ========================================================= */
.em-calendar-theme-wrapper {
    background: #ffffff !important;
    border-radius: 6px;
    width: 100% !important;
    display: block;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    padding: 20px;
}

.em-cal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    width: 100%;
}

.em-cal-month-select {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    cursor: pointer !important;
    user-select: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    transition: background-color 0.2s ease !important;
}

.em-cal-month-select:hover {
    background-color: #f1f5f9 !important;
}

.em-cal-arrow-down {
    transition: transform 0.2s ease;
}

.em-cal-month-select:hover .em-cal-arrow-down {
    transform: translateY(2px);
}

.em-cal-nav-buttons {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.em-cal-nav-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    padding: 6px 14px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
}

.em-cal-nav-btn.em-today {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: #64748b !important;
}

.em-cal-nav-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}


/* =========================================================
 * 2. QUICK MONTH & YEAR PICKER DROPDOWN (PAST/FUTURE YEARS)
 * ========================================================= */
.ccf-picker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: 270px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    padding: 14px;
    margin-top: 8px;
    cursor: default;
}

.ccf-picker-dropdown.show {
    display: block;
}

.ccf-picker-header {
    margin-bottom: 12px;
}

.ccf-picker-year-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    box-sizing: border-box;
}

.ccf-picker-year-select:focus {
    outline: none;
    border-color: #339787;
}

.ccf-picker-months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ccf-picker-month-btn {
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.ccf-picker-month-btn:hover {
    background: #f0fdf4;
    border-color: #339787;
    color: #339787;
}

.ccf-picker-month-btn.active {
    background: #339787;
    border-color: #339787;
    color: #ffffff;
    font-weight: 600;
}


/* =========================================================
 * 3. CALENDAR GRID ENGINE (7 COLUMNS)
 * ========================================================= */
.em-cal-grid-wrapper {
    width: 100% !important;
    display: block !important;
}

.em-cal-weekdays {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.em-cal-dates-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    border-left: 1px solid #e2e8f0 !important;
    border-top: 1px solid #e2e8f0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ccf-cal-loading {
    grid-column: 1 / -1;
    padding: 50px 20px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.em-cal-day,
.em-cal-day-cell {
    min-height: 110px !important;
    padding: 8px 6px !important;
    border-right: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

.em-cal-day.other-month,
.em-cal-day-cell.other-month {
    background: #f8fafc !important;
}

.em-cal-day.other-month .em-day-num,
.em-cal-day-cell.other-month .em-cal-date-number {
    color: #cbd5e1 !important;
}

.em-day-num,
.em-cal-date-number {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    margin-bottom: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
}

.em-today-cell {
    background-color: #f0fdf4 !important;
}

/* Event badges present on date */
.em-day-num.has-event,
.em-cal-day-cell.has-event .em-cal-date-number {
    background: #339787 !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    font-weight: 700 !important;
    cursor: pointer;
}

/* Event tray & pills */
.em-day-events-wrap,
.em-events-tray {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
}

.em-cal-event-pill {
    background: #273a4d !important;
    color: #ffffff !important;
    font-size: 11px !important;
    padding: 3px 6px !important;
    border-radius: 3px !important;
    width: 96% !important;
    text-align: left !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-weight: 500 !important;
    display: block !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
}

.em-cal-event-pill:hover,
.em-cal-day:hover .em-cal-event-pill {
    background: #339787 !important;
}

.em-pill-time {
    color: #38bdf8 !important;
    font-weight: 700 !important;
    margin-right: 2px;
}

/* =========================================================
 * 4. POPUP MODAL OVERLAY & CARD (PERFECTLY CENTERED)
 * ========================================================= */
.em-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    z-index: 99999999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Force Flex centering even when jQuery .fadeIn() or .show() is used */
.em-modal-overlay[style*="display: block"] {
    display: flex !important;
}

.em-modal-container {
    background: #ffffff !important;
    width: 100% !important;
    max-width: 580px !important;
    border-radius: 12px !important;
    padding: 28px 32px !important;
    position: relative !important;
    margin: auto !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35) !important;
    box-sizing: border-box !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    animation: emModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes emModalPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.em-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 16px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 20px !important;
}

.em-modal-header h3 {
    margin: 0 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.em-modal-close {
    background: #f1f5f9 !important;
    border: none !important;
    font-size: 22px !important;
    cursor: pointer !important;
    color: #64748b !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.em-modal-close:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.em-modal-event-title {
    color: #0f172a !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    margin: 0 0 14px 0 !important;
    line-height: 1.3 !important;
}

.em-modal-meta-line {
    font-size: 14px !important;
    color: #475569 !important;
    margin: 6px 0 !important;
}

.em-modal-thumb-wrap {
    margin: 15px 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.em-modal-thumb-wrap img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    border-radius: 8px !important;
}

.em-modal-content-body {
    margin: 18px 0 !important;
    color: #334155 !important;
    line-height: 1.65 !important;
    font-size: 14px !important;
}

.em-modal-video-wrap {
    margin: 16px 0 !important;
}

/* =========================================================
 * MODAL FOOTER ACTION CONTROLS (EDIT & TRASH)
 * ========================================================= */
.em-modal-footer-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    width: 100%;
}

.em-modal-footer-actions .cmd-action-buttons-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 16px !important;
}