/* โหลดฟอนต์ TH Sarabun PSK */
@font-face {
    font-family: 'THSarabun';
    src: url('fonts/THSarabun.ttf') format('truetype');
    font-weight: normal;
}

@font-face {
    font-family: 'THSarabun';
    src: url('fonts/THSarabunBold.ttf') format('truetype');
    font-weight: bold;
}

/* ปรับหัวข้อหมวดหมู่วิดีโอ (accordion-category) */
.accordion-category {
    width: 100%;
    text-align: center;           /* ⭐ ข้อความอยู่ตรงกลาง */
    background: #f5f5f5;
    padding: 12px 20px;
    margin-top: 10px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;

    transition: all 0.3s ease;    /* ⭐ ทำให้ลอยขึ้นนุ่ม */
}

/* Hover effect: ลอยขึ้น + เงา + สีเข้มขึ้น */
.accordion-category:hover {
    transform: translateY(-3px);  /* ⭐ ลอยขึ้น 3px */
    background: #e9ecef;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}


/* ตั้งค่าให้ทั้งเว็บใช้ฟอนต์นี้ */
body {
    font-family: 'THSarabun', sans-serif;
    font-size: 22px; /* TH Sarabun PSK ขนาดที่เหมาะสม */
}


body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    /* background: #f8f9fa; */
    background: #ffffff;
    color: #333;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    width: 50px;
    margin-right: 15px;
}

.title {
    font-size: 20px;
    font-weight: bold;
}

/* --- Countdown Box --- */
.countdown-box {
    margin-left: auto;
    font-size: 16px;
    color: #007bff;
    font-weight: bold;
}

/* กล่องหัวข้อ manual */
.manual-header {
    text-align: center;
    margin-bottom: 25px;
    /* color: #ffffff; */
}

/* GIF รูปหัวข้อ */
.manual-title-gif {
    width: 160px;
    max-width: 50%;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
}

/* เส้นคั่นแบบในภาพ */
.manual-divider {
    width: 120px;
    height: 3px;
    background: #9ed0f5;   /* ฟ้าอ่อนแบบเดียวกับรูป */
    margin: 8px auto 20px auto;
    border-radius: 10px;
}

/* ช่องค้นหา */
.manual-search-box {
    width: 100%;
    max-width: 450px;
    padding: 12px 15px;
    font-size: 20px;
    border: 2px solid #bcd7ff;
    border-radius: 10px;
    margin: 0 auto 25px auto;
    display: block;
    transition: 0.2s;
}

.manual-search-box:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 8px rgba(41,128,185,0.3);
}


/* --- Marquee --- */
.marquee {
    background: #fffae6;
    padding: 8px 0;
    color: #d48806;
    font-size: 14px;
    border-bottom: 1px solid #f0e6cc;
    white-space: nowrap;
    overflow: hidden;
}

.marquee span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 30s linear infinite;
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* --- Menu Buttons --- */
.manual-title-gif {
    width: 50%;          /* ให้ปรับตามพื้นที่ */
    max-width: 100px;      /* จำกัดขนาดสูงสุด */
    height: auto;          /* อัตราส่วนภาพไม่เสีย */
    display: block;
    margin: 0 auto 15px auto;
}
.menu {
    display: flex;
    gap: 15px;
    justify-content: center; 
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}

.menu button {
    padding: 10px 20px;
    border: none;
    background: #e9ecef;
    cursor: pointer;
    border-radius: 10px;
    transition: 0.35s ease;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;

    background-size: 200% 200%;
}

.menu button:hover {
    transform: translateY(-3px) scale(1.03);
    color: white;

    background-image: linear-gradient(135deg, #A8E063, #56AB2F, #00C853);
    animation: gradientMove 2.5s ease infinite;
}

/* ⭐ ป้องกัน icon เปลี่ยนสีเมื่อ hover */
.menu button:hover img {
    filter: none !important;
}

.menu img {
    width: 20px;
    transition: 0.3s;
}

.menu button.active-menu {
    transform: translateY(-3px) scale(1.05);   /* ใหญ่ขึ้นนิดนึง */
    color: white;
    background-image: linear-gradient(135deg, #A8E063, #56AB2F, #00C853);
    animation: gradientMove 2.5s ease infinite;
}
.menu button.active-menu img {
    filter: none !important;
}

/* ไอคอนกลายเป็นสีขาว + ขยายเมื่อ hover */
.menu button:hover img {
    transform: scale(1.25);
    filter: brightness(0) invert(1);
}

/* Animation ไล่สี */
@keyframes gradientMove {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}


/* --- Content --- */
.content {
    padding: 20px;
}

iframe {
    width: 100%;
    height: 800px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* --- Manual Grid --- */
.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.manual-card {
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #dcdcdc;
    transition: 0.25s;
}

.manual-card:hover {
    transform: translateY(-5px);
    box-shadow: 0px 4px 12px rgba(0,0,0,0.15);
}

.manual-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
}

/* ================= Modal พื้นฐาน ================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 3000;           /* 🔥 สูงกว่า popup list */
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 85%;
    max-width: 1100px;
    height: 85%;
    background: #000;
    border-radius: 14px;
    position: relative;
}

.modal-content iframe {
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

.close {
    position: absolute;
    top: -10px;
    right: 10px;
    font-size: 48px;
    color: #fff;
    cursor: pointer;
}


.close:hover {
    color: #000;
}

.manual-card {
    width: 100%;
    min-height: 260px;
    padding: 15px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dcdcdc;
    transition: 0.25s;
    cursor: pointer;
    text-align: center;
}

.manual-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.15);
}

.manual-cover {
    width: 100%;
    height: 200px;    /* ความสูงเพิ่มขึ้น */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.manual-card p {
    font-size: 20px;
    font-weight: 500;
    padding: 0 5px;
    color: #333;
    line-height: 1.2;
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 40px;   /* ระยะห่างเพิ่มขึ้น */
    margin-top: 30px;  /* เพิ่มด้านบน */
}

.video-card {
    width: 180px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 35, 35, 0.1);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: 0.3s ease;
}
.video-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 25px;           /* ⭐ ระยะห่างระหว่างการ์ด */
    padding: 15px 5px;   /* ⭐ ระยะภายในกริด */
}
.video-card:hover {
    transform: translateY(-5px);
}

.video-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
}

/* overlay แสดงปุ่มเล่น */
.play-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: 120px;
    background: rgba(0,0,0,0.45);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: 0.25s ease;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-overlay img {
    width: 40px;
}

.video-title {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
}

/* กล่องปุ่มหมวดวิดีโอ */
.video-category-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #ffffff;
    padding: 18px 20px;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: 0.25s ease;
}

.video-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* หัวข้อหมวดวิดีโอใน popup */
#popupTitle {
    color: #ffffff;          /* สีขาว */
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
}

#popupTitle {
    color: #ffffff !important;
}

#popupTitle {
    color: #ffffff;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.video-category-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ff855e, #6ab7ff);
    display:flex;
    align-items:center;
    justify-content:center;
}

.video-category-icon img {
    width: 24px;
    height: 24px;
}

.video-category-text {
    font-size: 18px;
    font-weight: 600;
}

/* grid 3 คอลัมน์ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 20px;
    margin-top: 10px;
    padding: 10px;
}
/* ================= Popup list วิดีโอ ================= */
.video-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(2px);
    z-index: 1000;          /* ต่ำกว่า videoModal */
    justify-content: center;
    align-items: center;
}

.video-popup {
    width: 85%;
    max-width: 1000px;
    max-height: 80vh;
    background: rgba(0,0,0,0.25);
    border-radius: 20px;
    padding: 25px;
    overflow-y: auto;
    position: relative;
}

.video-popup-close {
    position: absolute;
    right: 15px;
    top: -10px;
    font-size: 70px;
    color: #fff;
    cursor: pointer;
}

#popupTitle {
    text-align: center;
    color: #fff;
    font-weight: 700;
    margin-bottom: 20px;
}

.video-popup-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
}

/* Grid ของรายการวิดีโอใน popup */
.popup-video-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

/* ใช้ card เดิมของ video ได้เลย */

#videoModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;   /* ต้องสูงกว่า list */
    background: rgba(0,0,0,0.65);
}

/*  */

/* กล่องครอบการ์ด จัดกลางหน้าจอ */
.center-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
}

/* การ์ดสี่เหลี่ยมผืนผ้า */
.rect-card {
    width: 70%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* รูปด้านใน */
.rect-card img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* cover ถ้าอยากเต็ม */
    background: #000;
    transition: opacity 0.4s ease;
}

/* ปุ่มควบคุม */
.rect-controls {
    margin-top: 18px;
    display: flex;
    gap: 20px;
}

.rect-controls button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    font-size: 26px;
    cursor: pointer;
    background: #01dad1;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: 0.25s;
}

.rect-controls button:hover {
    background: #0f7e77;
    transform: scale(1.1);
}



