/* modal.css */
/* สไตล์สำหรับ Iframe Modal ที่ใช้ร่วมกัน */

.iframe-modal {
  display: none; /* ซ่อนไว้ก่อน */
  position: fixed; /* แสดงทับเนื้อหาอื่น */
  z-index: 1000; /* อยู่ชั้นบนสุด */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto; 
  background-color: rgba(0,0,0,0.8); /* พื้นหลังมืด */
  justify-content: center;
  align-items: center;
  /* เพิ่ม transition เพื่อความนุ่มนวล */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.iframe-modal.active {
  display: flex; /* เปลี่ยนเป็น flex เพื่อโชว์ */
  opacity: 1;
}

.iframe-modal-content {
  position: relative;
  background-color: #1e1d1a; /* สีพื้นหลังของกรอบ */
  border: 1px solid #ffc400; /* สีเส้นขอบ */
  width: 90%; 
  height: 90vh; /* สูง 90% ของหน้าจอ */
  max-width: 1400px; 
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
  padding: 10px; 
  border-radius: 8px;
  /* เพิ่ม transition */
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.iframe-modal.active .iframe-modal-content {
  transform: scale(1);
}

.iframe-close-btn {
  position: absolute;
  top: -15px; /* ยื่นออกมานอกกรอบ */
  right: -15px; /* ยื่นออกมานอกกรอบ */
  color: #1e1d1a;
  background: #ffc400;
  font-size: 28px;
  font-weight: bold;
  border-radius: 50%;
  border: none;
  width: 35px;
  height: 35px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  z-index: 1001;
}

.iframe-close-btn:hover,
.iframe-close-btn:focus {
  background: #fff;
  color: #ffc400;
  text-decoration: none;
}

/* * (สำคัญ) ส่วนนี้คือส่วนที่รองรับมือถือครับ 
 * (max-width: 900px)
 */
@media (max-width: 900px) {
  .iframe-modal-content {
    width: 95%;
    height: 90vh; 
    padding: 5px;
  }
  .iframe-close-btn {
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    line-height: 26px;
    font-size: 24px;
  }
}