/* --- CSS UNTUK TAMPILAN WEB --- */
.ki-wrapper { font-family: 'Segoe UI', sans-serif; max-width: 100%; margin: 20px auto; background: #f9f9f9; padding: 20px; border-radius: 8px; }
.ki-header { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.ki-title h2 { margin: 0; font-size: 1.5rem; color: #333; }
.ki-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ki-btn { padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; color: white; font-size: 14px; display: flex; align-items: center; gap: 5px; text-decoration: none; }
.ki-btn-green { background-color: #27ae60; }
.ki-btn-dark { background-color: #2c3e50; }
.ki-select { padding: 8px; border: 1px solid #ddd; border-radius: 4px; }

/* Calendar Container */
/* UPDATE: Ditambahkan overflow-x auto agar bisa discroll */
.ki-calendar-container { 
    background: #fff; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    border-radius: 8px; 
    overflow-x: auto; /* KUNCI: Scroll Horizontal Aktif */
    max-width: 297mm; 
    margin: 0 auto; 
    -webkit-overflow-scrolling: touch; /* Smooth scroll di iOS */
}

.ki-cal-header { background: #2c3e50; color: #fff; padding: 20px; display: flex; justify-content: space-between; align-items: center; }
.ki-nav-btn { background: rgba(255,255,255,0.1); border: none; color: white; padding: 5px 15px; font-size: 20px; cursor: pointer; border-radius: 4px; }
.ki-month-title { text-align: center; font-size: 2.2rem; font-weight: 800; margin: 0; color: #fff; }
.ki-grid-days { display: grid; grid-template-columns: repeat(7, 1fr); background: #ecf0f1; border-bottom: 1px solid #ddd; }
.ki-day-name { padding: 10px; text-align: center; font-weight: bold; font-size: 1rem; color: #444; text-transform: uppercase; }
.ki-day-name.sunday { color: #c0392b; }
.ki-grid-dates { display: grid; grid-template-columns: repeat(7, 1fr); background: #fff; }
.ki-date-cell { min-height: 100px; border-right: 1px solid #eee; border-bottom: 1px solid #eee; padding: 8px; position: relative; }
.ki-date-cell:nth-child(7n) { border-right: none; }
.ki-date-num { font-weight: bold; font-size: 1.1rem; color: #333; }

/* WARNA TANGGAL DAN LABEL */
.ki-date-cell.weekend .ki-date-num, .ki-date-cell.holiday .ki-date-num { color: #c0392b; } /* Merah */
.ki-date-cell.observance .ki-date-num { color: #2e7d32; } /* Hijau */

.ki-holiday-label { font-size: 0.75rem; margin-top: 5px; padding: 2px 4px; border-radius: 3px; display: block; }
.ki-holiday-label.national { background: #fdeaea; color: #c0392b; } /* Label Merah */
.ki-holiday-label.cuti { background: #fff3e0; color: #ef6c00; } /* Label Orange */
.ki-holiday-label.observance { background: #e8f5e9; color: #2e7d32; } /* Label Hijau */

.ki-print-footer { display: none; }

/* RESPONSIVE: Scroll Horizontal untuk Layar Kecil */
@media (max-width: 768px) {
    /* Paksa lebar minimum agar konten tidak gepeng dan memicu scrollbar */
    .ki-cal-header, 
    .ki-grid-days, 
    .ki-grid-dates {
        min-width: 800px; 
    }
    
    .ki-date-cell {
        min-height: 80px; /* Sedikit lebih pendek di mobile agar ringkas */
    }
    
    /* Indikator scrollbar agar terlihat user */
    .ki-calendar-container::-webkit-scrollbar {
        height: 6px;
    }
    .ki-calendar-container::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }
}

/* --- CSS PDF GENERATOR --- */
#ki-print-wrapper { position: absolute; top: 0; left: 0; width: 297mm; z-index: -9999; background: white; opacity: 0; pointer-events: none; }
body.generating-pdf #ki-print-wrapper { opacity: 1; z-index: 99999; top: 0; left: 0; }

.ki-print-page { width: 297mm; height: 210mm; padding: 10mm; box-sizing: border-box; display: flex; flex-direction: column; background: white; margin-bottom: 20px; }
.ki-print-header-page { text-align: center; font-weight: bold; font-size: 18pt; margin-bottom: 5mm; border-bottom: 3px solid #000; padding-bottom: 3mm; color: #000; }
.ki-print-grid-container { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10mm; }
.ki-print-month-card { border: 1px solid #000; display: flex; flex-direction: column; }
.ki-mini-header { background: #333; color: #fff; text-align: center; padding: 5px; font-weight: bold; font-size: 14pt; }
.ki-mini-days { display: grid; grid-template-columns: repeat(7, 1fr); background: #eee; border-bottom: 1px solid #000; font-size: 10pt; font-weight: bold; text-align: center; padding: 3px 0; color: #000; }
.ki-mini-days .red { color: #c0392b; }

.ki-mini-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); }
.ki-mini-cell { border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; font-size: 12pt; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #000; }
.ki-mini-cell:nth-child(7n) { border-right: none; }

/* Warna di Print Mini Calendar */
.ki-mini-cell.red { color: #c0392b; } /* Merah */
.ki-mini-cell.green { color: #2e7d32; font-weight:bold; } /* Hijau */
.ki-mini-cell.prev, .ki-mini-cell.next { background: #f9f9f9; }

.ki-print-holiday-list { margin-top: 5mm; font-size: 9pt; border-top: 1px dotted #000; padding-top: 2mm; color: #444; }
.ki-print-holiday-list strong { color: #000; margin-right: 5px; }
.ki-print-holiday-list span { display: inline-block; margin-right: 10px; }
.ki-print-holiday-list span.green-text { color: #2e7d32; }

#ki-loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); color: white; z-index: 100000; display: flex; flex-direction: column; justify-content: center; align-items: center; }