/* =========================================
   1. Import Fonts & Variables
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600&family=Sarabun:wght@300;400;500&display=swap');

:root {
    /* Theme Colors (เปลี่ยนสีโรงเรียนได้ที่นี่) */
    --primary: #2563eb;       /* สีน้ำเงินหลัก */
    --primary-dark: #1e40af;  /* สีน้ำเงินเข้ม (ตอนชี้) */
    --secondary: #64748b;     /* สีเทา */
    --accent: #f59e0b;        /* สีส้ม (เน้น) */
    
    /* Status Colors */
    --success: #10b981;       /* ผ่าน */
    --danger: #ef4444;        /* ไม่ผ่าน/ลบ */
    --warning: #f59e0b;       /* รอตรวจสอบ */

    /* Backgrounds */
    --bg-body: #f1f5f9;       /* พื้นหลังเว็บ */
    --bg-card: #ffffff;       /* พื้นหลังการ์ด */
    
    /* Layout */
    --radius: 12px;           /* ความโค้งขอบ */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* =========================================
   2. Global Reset
   ========================================= */
* { box-sizing: border-box; }

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-body);
    color: #334155;
    margin: 0;
    padding: 40px 20px;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 {
    font-family: 'Prompt', sans-serif;
    color: #1e293b;
    margin-top: 0;
}

a { text-decoration: none; color: var(--primary); transition: 0.3s; }
a:hover { color: var(--primary-dark); }

/* =========================================
   3. Main Container
   ========================================= */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 5px solid var(--primary); /* แถบสีด้านบน */
}

/* =========================================
   4. Hero Section (ส่วนหัวหน้าแรก)
   ========================================= */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px dashed #e2e8f0;
}

.school-logo {
    font-size: 60px;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px rgba(37, 99, 235, 0.1);
}

.hero-section h1 {
    font-size: 28px;
    margin-bottom: 5px;
    color: var(--primary-dark);
}

.hero-section p {
    color: var(--secondary);
    font-size: 16px;
}

/* =========================================
   5. Menu Grid (ปุ่มเมนูหน้าแรก)
   ========================================= */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.menu-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
    transition: 0.3s;
}

/* สีเฉพาะของแต่ละปุ่ม */
.card-register .icon-box { background: #eff6ff; color: var(--primary); }
.card-register:hover .icon-box { background: var(--primary); color: white; }

.card-status .icon-box { background: #ecfdf5; color: var(--success); }
.card-status:hover .icon-box { background: var(--success); color: white; }

.card-admin .icon-box { background: #fff7ed; color: var(--warning); }
.card-admin:hover .icon-box { background: var(--warning); color: white; }

.text-box h3 { font-size: 18px; margin-bottom: 5px; }
.text-box p { font-size: 14px; color: var(--secondary); margin: 0; }

/* =========================================
   6. Forms (ฟอร์มสมัครเรียน)
   ========================================= */
.form-group { margin-bottom: 20px; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Sarabun', sans-serif;
    transition: 0.2s;
    background-color: #fff;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =========================================
   7. Buttons (ปุ่มกด)
   ========================================= */
button, .btn {
    display: inline-block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-family: 'Prompt', sans-serif;
}

button:hover, .btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* ปุ่มลิงก์เล็กๆ */
.nav-link { font-size: 14px; color: var(--secondary); }
.nav-link:hover { text-decoration: underline; }

/* =========================================
   8. News Board (กระดานข่าว)
   ========================================= */
.news-board {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
}

.news-header {
    background: #f8fafc;
    padding: 15px 20px;
    font-weight: 600;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
    font-family: 'Prompt', sans-serif;
}

.news-item {
    padding: 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.news-item:last-child { border-bottom: none; }

.news-title { font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.news-desc { font-size: 14px; color: var(--secondary); }
.news-date { font-size: 12px; color: #94a3b8; white-space: nowrap; margin-left: 15px;}

/* =========================================
   9. Tables & Status (ตารางแอดมิน/สถานะ)
   ========================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
    text-align: left;
    padding: 15px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

td { padding: 15px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fafc; }

/* ป้ายสถานะ */
[class^="status-"] {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-pending { background: #fff7ed; color: #c2410c; }
.status-approved { background: #ecfdf5; color: #047857; }
.status-rejected { background: #fef2f2; color: #b91c1c; }

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* =========================================
   10. Print Mode (หน้าพิมพ์ใบสมัคร)
   ========================================= */
@media print {
    .no-print, button, .nav { display: none !important; }
    body { background: white; padding: 0; margin: 0; }
    .container { 
        box-shadow: none; 
        border: none; 
        width: 100%; 
        max-width: 100%; 
        padding: 0;
        margin: 0;
    }
    .paper-header { margin-top: 0; }
    /* บังคับให้พิมพ์ background color มาด้วย */
    -webkit-print-color-adjust: exact;
}

/* =========================================
   11. Mobile Responsive
   ========================================= */
@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 20px; }
    .news-item { flex-direction: column; align-items: flex-start; }
    .news-date { margin-left: 0; margin-top: 8px; }
    th, td { padding: 10px 5px; font-size: 13px; }
    
    /* ให้ตารางเลื่อนซ้ายขวาได้ในมือถือ */
    .table-responsive { overflow-x: auto; }
}