@import url('https://fonts.googleapis.com/css2?family=Kanit:wght=300;400;500;600&display=swap');

/* 🔒 บังคับหน้าต่างหลักล็อกความสูงเท่าจอจริง เพื่อให้สิทธิ์การเลื่อนไปอยู่ที่กล่องข้อมูลด้านใน */
html, body {
    font-family: 'Kanit', sans-serif;
    overscroll-behavior-y: none; /* ป้องกัน Pull-to-refresh บนมือถือ */
    background-color: #f3f4f6; 
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    margin: 0; padding: 0;
}

.app-container {
    height: 100dvh !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

/* จำกัดพื้นที่ความสูงเนื้อหาฝั่งขวา */
main {
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* ⏳ Global Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    border: 4px solid #e5e7eb;
    border-top: 4px solid #10b981;
    border-radius: 50%;
    width: 48px; height: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); } /* แก้ไขเติม % เรียบร้อย ลบตัวแดงกวนใจ */
    100% { transform: rotate(360deg); }
}

/* 🧱 Shimmer Loader */
.shimmer {
    background: #f6f7f8;
    background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%; 
    animation: placeholderShimmer 1.5s linear infinite;
}

@keyframes placeholderShimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

/* 🖨️ จัดการรูปแบบกระดาษตอนแคปหน้าจอเป็นแนวนอน (Rule 28 - Landscape Layout) */
@media print {
    @page {
        size: landscape;
        margin: 10mm;
    }
    .no-print { display: none !important; }
    .print-only { display: block !important; }
    body, .app-container, main { 
        background: white !important; 
        height: auto !important;
        overflow: visible !important;
    }
    .shadow-sm, .shadow-md, .shadow-lg { box-shadow: none !important; }
    input, select, textarea {
        border: none !important;
        background: transparent !important;
        appearance: none;
        -webkit-appearance: none;
    }
    table { width: 100% !important; page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }
}

/* 📌 แถบเลื่อน Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { height: 8px; width: 8px; display: block; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 🚀 ปลดล็อกแถบเลื่อนแนวตั้งให้พื้นที่ทำงานหลัก (แก้ปัญหารายชื่อพนักงานแสดงไม่ครบ) */
main > div.custom-scrollbar {
    flex: 1 1 0% !important;
    overflow-y: scroll !important;
    display: block !important;
    -webkit-overflow-scrolling: touch;
}

/* 📝 ปรับแต่งช่องหมายเหตุเป็นแบบ Textarea ยืดหยุ่นสูง (Rule 10) */
.inp-remark {
    min-width: 220px !important;
    max-height: 150px !important;
    resize: none !important;
    overflow-y: auto !important;
    transition: height 0.1s ease;
}