/* ==========================================

APPLE LIQUID & GLASSMORPHISM DESIGN
========================================== */

:root {
/* ตัวแปรสีและแสงเงาสำหรับความโปร่งแสง */
--glass-bg: rgba(255, 255, 255, 0.75);
--glass-border: rgba(255, 255, 255, 0.6);
--glass-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.07), 0 0 1px 1px rgba(255, 255, 255, 0.4);
--apple-blue: #0071e3;
}

body {
background-color: #f5f5f7;
color: #1d1d1f;
overflow-x: hidden;
position: relative;
min-height: 100vh;
/* ฟอนต์หลัก ถูกกำหนดจาก Tailwind config ใน HTML แล้ว แต่เผื่อไว้ */
font-family: 'Prompt', sans-serif;
}

/* พื้นหลังแบบของเหลว (Liquid Mesh Gradient) */
.liquid-bg {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: -1;
background: radial-gradient(circle at 50% 0%, #ffffff 0%, #eef2f6 100%);
overflow: hidden;
}

/* รูปทรงของเหลวเบลอๆ พื้นหลัง */
.liquid-blob {
position: absolute;
filter: blur(80px);
opacity: 0.6;
border-radius: 50%;
animation: float 20s infinite alternate ease-in-out;
}
.blob-1 { width: 500px; height: 500px; background: #e0f2fe; top: -100px; left: -100px; }
.blob-2 { width: 400px; height: 400px; background: #dbeafe; bottom: -50px; right: -50px; animation-delay: -5s; }
.blob-3 { width: 300px; height: 300px; background: #f3e8ff; top: 40%; left: 50%; transform: translate(-50%, -50%); animation-delay: -10s; }

@keyframes float {
0% { transform: translate(0, 0) scale(1); }
100% { transform: translate(30px, 50px) scale(1.1); }
}

/* คลาสกระจกโปร่งแสง */
.glass-card {
background: var(--glass-bg);
backdrop-filter: blur(24px) saturate(190%);
-webkit-backdrop-filter: blur(24px) saturate(190%);
border: 1px solid var(--glass-border);
box-shadow: var(--glass-shadow);
}

.glass-nav {
background: rgba(255, 255, 255, 0.82);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* สไตล์กล่องข้อความ (Inputs) */
.apple-input {
background: rgba(255, 255, 255, 0.9);
border: 1px solid rgba(0, 0, 0, 0.14);
transition: all 0.25s ease;
}

.apple-input:focus {
background: #ffffff;
border-color: var(--apple-blue);
box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
outline: none;
}

/* ปุ่มกด (Buttons) */
.apple-btn {
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.apple-btn:active {
transform: scale(0.96);
}

/* ==========================================
2. A4 OFFICIAL PRINT LAYOUT (โครงสร้างแบบฟอร์มราชการ)
========================================== */

/* ซ่อนพื้นที่ A4 ไว้จนกว่าจะสั่งพิมพ์ */
#a4-print-container {
display: none;
}

/* รูปแบบหน้ากระดาษ A4 จำลองบนหน้าจอ (เผื่อใช้ Preview ก่อนพิมพ์) */
.a4-sheet-preview {
width: 210mm;
min-height: 297mm;
padding: 12mm 15mm;
margin: 0 auto 24px auto;
background: white;
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
font-family: 'Sarabun', serif;
color: #000;
box-sizing: border-box;
position: relative;
}

/* กล่องตีกรอบรอบใบสมัคร */
.official-form-box {
border: 1.5px solid #000;
position: relative;
}

/* ตารางมาตรฐานราชการ */
.official-table {
width: 100%;
border-collapse: collapse;
}
.official-table th, .official-table td {
border: 1px solid #000;
padding: 4px 8px;
}

/* กล่องติ๊กถูก (Checkbox สี่เหลี่ยม) */
.chk-box {
display: inline-flex;
align-items: center;
justify-content: center;
width: 13px;
height: 13px;
border: 1.2px solid #000;
margin-right: 4px;
font-size: 10px;
font-weight: bold;
vertical-align: middle;
}

/* จุดไข่ปลา / เส้นประ สำหรับเติมคำ */
.official-dotted {
border-bottom: 1px dotted #000;
display: inline-block;
padding: 0 4px;
font-weight: 600;
color: #000;
text-align: center;
}

/* ==========================================
3. PRINT MEDIA QUERIES (เมื่อกดสั่ง Print เท่านั้น)
========================================== /
@media print {
/ ตั้งค่าหน้ากระดาษเป็น A4 และลบขอบขาวเริ่มต้นของเบราว์เซอร์ */
@page {
size: A4 portrait;
margin: 0mm;
}

/* รีเซ็ตโครงสร้างหน้าเว็บทั้งหมด */
html, body {
    width: 210mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important; /* บังคับพิมพ์สีพื้นหลัง */
}

/* ซ่อน UI ทั้งหมดที่ไม่เกี่ยวกับใบสมัคร */
.no-print, nav, main, footer, .liquid-bg, .modal-backdrop {
    display: none !important;
}

/* แสดงเฉพาะตู้คอนเทนเนอร์ของ A4 */
#a4-print-container {
    display: block !important;
    width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Sarabun', serif !important;
    color: #000000 !important;
    background: #ffffff !important;
}

/* ตั้งค่าแต่ละหน้าของใบสมัคร A4 ให้แยกแผ่นกันชัดเจน */
.a4-print-page {
    width: 210mm !important;
    height: 297mm !important;
    padding: 0 !important; /* เว้นขอบผ่าน HTML ด้านในแทน */
    margin: 0 !important;
    box-sizing: border-box !important;
    page-break-after: always; /* บังคับขึ้นหน้าใหม่ */
    position: relative;
    background: #ffffff !important;
    overflow: hidden;
}

/* หน้าสุดท้ายไม่ต้องขึ้นหน้าใหม่แล้ว */
.a4-print-page:last-child {
    page-break-after: auto;
}


}