/* =========================================================
   LICH LAM VIEC - Monthly Calendar Grid
   ========================================================= */

/* ── Outer wrapper ── */
.cal-wrapper {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(22,60,116,0.08);
    overflow: hidden;
    border: 1px solid #e8eef8;
}

/* ── Top bar ── */
.cal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e8eef8;
    flex-wrap: wrap;
    gap: 10px;
}

.cal-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e3a6e;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cal-title i { color: #2563c7; font-size: 1.05rem; }

/* Month nav */
.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cal-nav-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #d5e0f5;
    background: #fff;
    color: #2563c7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.15s;
}
.cal-nav-btn:hover:not([disabled]) { background: #2563c7; color: #fff; border-color: #2563c7; }
.cal-nav-btn[disabled] { opacity: 0.35; cursor: default; }

.cal-month-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e3a6e;
    padding: 4px 14px;
    border: 1px solid #d5e0f5;
    border-radius: 8px;
    background: #f4f8ff;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.cal-month-label:hover { background: #e5eeff; }
.cal-month-label i { color: #2563c7; font-size: 0.8rem; }

/* View tabs (Tháng / Tuần / Hôm nay) */
.cal-view-tabs {
    display: flex;
    gap: 4px;
}
.cal-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #d5e0f5;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    color: #667085;
    cursor: pointer;
    transition: all 0.15s;
}
.cal-tab.active, .cal-tab:hover {
    background: #2563c7;
    border-color: #2563c7;
    color: #fff;
}

/* ── Grid wrapper ── */
.cal-grid-wrap {
    overflow-x: auto;
}

/* ── Column header row ── */
.cal-head-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e8eef8;
    background: #f4f8ff;
}
.cal-head-cell {
    padding: 10px 6px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #2563c7;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-right: 1px solid #e8eef8;
}
.cal-head-cell:last-child { border-right: none; }
.cal-head-cell.weekend { color: #e53e3e; }

/* ── Calendar rows ── */
.cal-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e8eef8;
    min-height: 110px;
}
.cal-row:last-child { border-bottom: none; }

/* ── Day cell ── */
.cal-cell {
    border-right: 1px solid #e8eef8;
    padding: 8px;
    vertical-align: top;
    min-height: 110px;
    background: #fff;
    transition: background 0.12s;
}
.cal-cell:last-child { border-right: none; }
.cal-cell:hover { background: #f9fbff; }

/* Other month - grayed out */
.cal-cell.other-month {
    background: #f8f9fb;
}
.cal-cell.other-month .cal-cell-num span { color: #bcc8d8; }

/* Weekend column */
.cal-cell.weekend { background: #fdfafe; }
.cal-cell.weekend .cal-cell-num span { color: #e53e3e; }

/* Today highlight */
.cal-cell.today-cell { background: #f0f6ff; }

/* ── Day number area ── */
.cal-cell-num {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.cal-cell-num span {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a6e;
    line-height: 1;
}
.today-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2563c7 !important;
    color: #fff !important;
    font-size: 0.82rem !important;
}
.today-badge {
    font-size: 0.58rem;
    font-weight: 700;
    background: #ffd166;
    color: #7a4800;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: 0.02em;
}

/* ── Events inside cell ── */
.cal-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cal-event {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    cursor: pointer;
}
.cal-event:hover .cal-event-title { color: #2563c7; }

.cal-event-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2563c7;
    flex-shrink: 0;
    margin-top: 4px;
}

.cal-event-body { flex: 1; min-width: 0; }

.cal-event-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e3a6e;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}

.cal-event-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 3px;
}
.cal-event-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.66rem;
    color: #667085;
}
.cal-event-meta i { font-size: 0.62rem; color: #2563c7; }

/* ── No event text ── */
.cal-no-event {
    font-size: 0.68rem;
    color: #c5cfe3;
    font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .cal-topbar { flex-direction: column; align-items: flex-start; }
    .cal-row { min-height: 80px; }
    .cal-cell { min-height: 80px; padding: 5px; }
    .cal-event-title { font-size: 0.68rem; }
    .cal-event-meta { display: none; }
}

/* ── Week View Toggle ── */
.week-view-active .cal-row {
    display: none;
}
.week-view-active .cal-row.has-active-day {
    display: grid;
}
