/* --- CSS สำหรับ Modal Popup --- */

/* ฉากหลังสีดำจางๆ (ซ่อนอยู่ด้วย display: none) */
.modal-overlay {
    display: none; 
    position: fixed; 
    z-index: 2000; /* ต้องมากกว่า Navbar */
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); /* สีดำโปร่งแสง */
    backdrop-filter: blur(3px); /* เบลอฉากหลังนิดๆ */
}

/* กล่องเนื้อหาตรงกลาง */
.modal-content {
    background-color: #fefefe;
    
    /* --- ส่วนที่แก้ไข --- */
    margin: 5% auto;      /* ปรับระยะห่างจากขอบบนลงมาหน่อย */
    width: 50%;           /* กว้าง 50% ของจอคอมพิวเตอร์ (ตามที่ขอ) */
    max-width: none;      /* ลบค่าจำกัดความกว้างเดิม (600px) ออก */
    
    /* แนะนำให้เพิ่มส่วนนี้ เพื่อรองรับเนื้อหาที่ยาวมากๆ ครับ */
    max-height: 85vh;     /* สูงไม่เกิน 85% ของความสูงจอ */
    overflow-y: auto;     /* ถ้าเนื้อหายาวเกิน ให้ขึ้น Scrollbar ด้านข้างเฉพาะในกล่อง */
    /* ---------------- */

    padding: 40px;        /* เพิ่ม padding ให้ดูไม่อึดอัด */
    border: 1px solid #888;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.4s;
}

/* ปุ่มปิด (x) มุมขวาบน */
.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
    transition: 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: #000;
    text-decoration: none;
}

/* จัดสไตล์เนื้อหาข้างใน */
.modal-header h2 {
    font-size: 28px;
    color: #3333CC;
    margin-bottom: 15px;
    border-bottom: 2px solid #d4a017;
    display: inline-block;
}
.modal-body p {
    font-size: 18px;
    margin-bottom: 10px;
    color: #555;
    line-height: 1.6;
    text-indent: 2em;
    text-align: justify;
}
.modal-body ul {
    margin-left: 20px;
    list-style-type: disc;
    color: #666;
}


/* สไตล์ปุ่มปิดด้านล่าง */
.btn-close-modal {
    background-color: #e0e0e0; /* สีเทาอ่อน */
    color: #333;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 30px; /* ปุ่มมน */
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Sarabun', sans-serif;
}

.btn-close-modal:hover {
    background-color: #c9302c; /* เปลี่ยนเป็นสีแดงเมื่อชี้ */
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.btn-close-modal i {
    margin-left: 5px;
}



/* Animation ตอนเด้งขึ้นมา */
@keyframes fadeIn {
    from {opacity: 0; transform: translateY(-50px);}
    to {opacity: 1; transform: translateY(0);}
}

/* ==================================================
   RESPONSIVE: Popup Modal
   ================================================== */

@media screen and (max-width: 768px) {
    .modal-content {
        width: 90%; /* มือถือให้กว้างเกือบเต็มจอ */
        margin: 15% auto; /* ขยับลงมาหน่อย */
        padding: 20px; /* ลดขอบใน */
    }
    
    .modal-header h2 { font-size: 1.5rem; }
    .close-btn { right: 10px; top: 5px; }
}