/* ============================================================
   NAVIGATION
============================================================ */
.khcal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 10px auto;
    gap: 8px;
    font-family: Khmer, "Noto Serif Khmer", serif;
}

.khcal-nav-title {
    flex: 1;
    text-align: center;
    font-family: Akbalmoul;
    font-weight: normal;
    font-size: 2.0rem;
}
/* Lunar months (បុស្ស–មាឃ) in title*/
.lunar-range {
	font-family: Hanuman;
  	color: #4a90e2;
  	font-weight: bold;
}

.khcal-nav-btn {
    background: #f5d742;
    border: 1px solid #e1c521;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.5rem;
    font-family: Angkor, "AngDaunKeo", serif;
    color: red;
}


/* ============================================================
   GRID LAYOUT
============================================================ */
.khcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    border: 4px solid #f5d742;
    border-radius: 13px;
    background: none;
    width: 100%;            /* responsive */
    max-width: 100%;        /* prevent overflow */
    overflow-x: hidden;     /* safety */
}

.khcal-cell {
    border: 1px solid #ddd;
    padding: 2px;
    min-height: 80px;
    box-sizing: border-box;
    font-size: 0.9rem;
    background: #fff;
    color: green;
    min-width: 0;           /* critical for responsive shrinking */
}

/* Empty cells with background images */
.khcal-empty {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.4;
}

.khcal-empty-leading {
    background-image: url('/img/calendar/cell1-bg.png');
}

.khcal-empty-trailing {
    background-image: url('/img/calendar/cell2-bg.png');
}


/* ============================================================
   WEEKDAY HEADERS
============================================================ */
.khcal-weekday {
    text-align: center;
    padding: 4px 2px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f5d742;
    font-weight: bold;
    line-height: 1.4;
}

.kh-wd-kh {
    font-family: Moul;
    font-size: 14px;
    color: green;
    font-weight: normal;
}

.kh-wd-en {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
    text-transform: uppercase;
}


/* ============================================================
   DATE CONTENT
============================================================ */
.khcal-solar {
    font-family: Moul;
    font-size: 1.5rem;
    font-weight: normal;
    color: #000;
    margin-bottom: 1px;
}

.khcal-lunar {
    font-family: Hanuman;
    font-size: 1.35rem;
    color: #444;
    white-space: normal;
}

/* Uposatha highlight */
.khcal-uposatha .khcal-solar,
.khcal-uposatha .khcal-lunar {
    color: #d32f2f;
    font-weight: bold;
}

/* added lotus bg on uposatha days */
.khcal-uposatha {
    background-image: url('/img/calendar/icons/lotus_sel.png') !important;
    background-repeat: no-repeat !important;

    /* Perfect center horizontally + vertically */
    background-position: center center !important;

    /* Adjust size to taste */
    background-size: 60% !important;

    /* Ensure the lotus is not covered */
    background-color: none !important;
}

/* ============================================================
   EVENTS
============================================================ */
.khcal-event-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    font-family: Moul;
    font-weight: normal;
    font-size: 1.2rem;
    color: red;
    line-height: 1.6;
}

/* Event color variations */
.khcal-event-item.khcal-shaving {
    color: #007bff;
}

.khcal-festival.khcal-vassa_in,
.khcal-festival.khcal-vassa_out {
    font-family: moul;
    font-weight: normal;
    color: red;
}

.khcal-festival.khcal-vassa_season,
.khcal-fullmoon {
    font-family: chenla;
	font-size: 1.1rem;
    font-weight: bold;
	padding-bottom: 0px;
}

.khcal-event-item.khcal-kathin_end,
.khcal-event-item.khcal-pchum {
    color: darkgreen;
}

/* Icons */
.khcal-icon {
    width: 30px;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

.khcal-moon-icon {
	display: none;
    width: 15px;
    height: 15px;
    vertical-align: text-top;
}

.moon-phase-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}
/* ============================================================
   SPECIAL STATES
============================================================ */
.khcal-today {
    border: 2px solid #f5d742;
    background: #ffeb69!important;
}

.khcal-event {
    background: #fff7f7;
}

.khcal-error {
    background: #ffecec;
}

.khcal-lunar-error {
    color: #c00;
}

.khcal-error-global {
    max-width: 800px;
    margin: 10px auto;
    padding: 8px;
    border: 1px solid #c00;
    background: #ffecec;
    color: #900;
    font-family: Khmer, "Noto Serif Khmer", serif;
}

.khcal-last-lunar-day {
    color: magenta;
    font-weight: bold;
}


/* ============================================================
   KHMER NEW YEAR
============================================================ */
.khcal-festival {
    font-family: moul, Khmer, "Noto Serif Khmer", serif;
    color: darkgreen;
    font-weight: normal;
    line-height: 1.6;
}

.khcal-khny {
    font-size: 1.2rem;
}
.khcal-khnytime {
	font-family: chenla;
	font-weight: bold;
	padding-top: 5px;
	color: red;
}

/* ============================================================
   RESPONSIVE — TABLET
============================================================ */
@media (max-width: 600px) {

    /* Remove theme padding that causes overflow */
    .entry-content,
    .wp-block-group,
    .wp-block {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}


/* ============================================================
   RESPONSIVE — MOBILE SHRINK FIX
============================================================ */
@media (max-width: 480px) {

    /* Cell box */
    .khcal-cell {
        font-size: 0.65rem;
        padding: 1px;
        min-height: 45px;
        line-height: 1.1;
    }

    /* Solar/Lunar text */
    .khcal-solar {
        font-size: 0.9rem;
    }

    .khcal-lunar {
        font-size: 0.65rem;
    }

    /* Event text */
    .khcal-event-item {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    /* Icons */
    .khcal-icon {
        width: 14px;
        height: 16px;
    }

    .khcal-moon-icon {
        width: 10px;
        height: 10px;
    }

    /* Weekday headers */
    .kh-wd-kh {
        font-size: 11px;
    }

    .kh-wd-en {
        font-size: 9px;
    }
}
