/* เพิ่มการประกาศตัวแปรสีที่ด้านบนสุดเพื่อให้ var(...) ทำงานได้ */
:root {
    --red-main: #800000;
    --brown-btn: #4a0000;
    --bg-light-pink: #fff5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f6f6f6;
    color: #333;
    margin: 0;
    padding: 0;
}

/* =========================
   HEADER
========================= */
.main-header {
    background: #8B0000;
    color: white;
    padding-bottom: 10px;
}

.top-bar {
    display: flex;
    margin: 0;
    justify-content: flex-end;
    padding-top: 20px;
    padding-bottom: 5px;
    padding-right: 2.5%;
    background: #8B0000;
}

.top-right {
    display: flex;
    gap: 5px;
    align-items: center;
}

.top-right span {
    color: #f4f4f4;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}

.logo-bar {
    display: flex;
    align-items: center;
    padding: 0 5% 10px 5%;
    gap: 25px;
}

.logo {
    height: 100px;
    width: auto;
}

.header-title h1 {
    font-family: 'Inria Serif', serif;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.2;
    color: white;
    margin: 0;
}

.header-title {
    margin-bottom: 12px;
}

/* =========================
   NAVIGATION
========================= */

nav {
    background: linear-gradient(90deg, #5c0000, #8B0000, #5c0000);
    padding: 10px 0;
    padding-top: 2px;
    padding-bottom: 20px;
    display: flex;
    top: 0;
    width: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 90px;
    flex-wrap: wrap;
}

nav ul li a {
    text-decoration: none;
    color: white;
}

nav ul li {
    color: white;
    cursor: pointer;
    position: relative;
    font-weight: 500;
    font-size: 18px;
    letter-spacing: 1px;
    transition: 0.3s ease;
}

nav ul li:hover {
    color: #ffe5e5;
}

nav ul li::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 0%;
    height: 2px;
    background: #ffffff;
    transition: 0.3s;
}

nav ul li:hover::after {
    width: 100%;
}


.dropdown {
    position: relative;
}

.dropdown-content a {
    color: #333333 !important;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 14px;
    transition: 0.3s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
    color: #990000 !important;
}

.dropdown-content {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);

    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);

    min-width: 260px;
    padding: 12px 0;
    border-radius: 12px;

    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);

    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.dropdown-content div {
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 600;
    color: #111111;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    cursor: pointer;
    border-left: 4px solid transparent;
}

.dropdown-content div:hover {
    background: #f3f3f3;
    border-left: 4px solid #8B0000;
    color: #000000;
    padding-left: 28px;
}

.dropdown:hover .dropdown-content {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* =========================
   HERO SECTION
========================= */
.hero {
    margin-top: 0px;
    height: 400px;
    background: url('What.png') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.hero-box {
    position: relative;
    z-index: 1;
    background: rgba(128, 0, 0, 0.9);
    color: white;
    padding: 30px;
    max-width: 800px;
    text-align: center;
}

.white-line {
    height: 2px;
    background: white;
    width: 60px;
    margin: 15px auto;
}

/* =========================
   ADMISSION ROUNDS
========================= */
/* ล็อคให้ Container เป็น Flex และจัดวางซ้าย-ขวา */
.round-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    /* ให้ของอยู่ด้านบนเสมอ */
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

/* ล็อคฝั่งปุ่ม (ซ้าย) ให้ขยายได้แต่ไม่เบียดฝั่งขวา */
.round-buttons {
    flex: 1;
    /* ใช้พื้นที่ที่เหลือด้านซ้าย */
    min-width: 0;
    /* ป้องกันเนื้อหาดันจน Flex แตก */
}


/* 3. ปรับแต่งสำหรับมือถือ (จอเล็ก) */
@media (max-width: 1024px) {
    .round-image {
        display: none;
        /* ซ่อนรูปบนแท็บเล็ตและมือถือเพื่อไม่ให้ทับเมนู */
    }
}

.round-image img {
    width: 150px;
    height: 150px;
    border-radius: 8px;
    box-shadow: 15px 15px 0px #e0e0e0;
}


.main-round-btn {
    width: 100%;
    max-width: 500px;
    padding: 20px 30px;
    background: var(--brown-btn);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: 0.3s;
}

.main-round-btn.active {
    background: var(--red-main);
}

.sub-projects {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.sub-projects.show {
    display: flex;
}

.sub-btn {
    width: 100%;
    max-width: 500px;
    background: var(--red-main);
    color: white;
    border: none;
    padding: 15px 20px;
    text-align: left;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
}

.quota-detail-content {
    background-color: var(--bg-light-pink);
    padding: 20px 30px;
    border-left: 5px solid var(--red-main);
    margin-top: 5px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

/* ฝั่งขวา: รูปภาพ */
.round-image {
    /* ล็อกนิ่งอยู่กับที่ ไม่ขยับตามการเลื่อนหรือเมาส์ */
    position: fixed !important;
    top: 50% !important;
    right: 50px !important;
    transform: translateY(-50%) !important;
    /* จัดกึ่งกลางแนวตั้งแบบนิ่งๆ */

    /* บังคับขนาดสี่เหลี่ยม */
    width: 450px !important;
    height: auto !important;
    border-radius: 0 !important;

    /* ตัดแอนิเมชันที่ทำให้รูปขยับออก */
    transition: opacity 0.3s ease !important;
    z-index: 99999 !important;

    /* ค่าพื้นฐานป้องกันเลย์เอาต์เพี้ยน */
    flex: none !important;
    margin: 0 !important;
}

/* เมื่อมีคลาส hide ให้หายไปทันที */
.round-image.hide {
    display: none !important;
    opacity: 0 !important;
}

.round-image img {
    width: 150px;
    height: 150px;
}

/* =========================
   FOOTER (เพิ่มส่วนที่เหลือ)
========================= */
.footer {
    background: var(--red-main);
    color: white;
    padding: 40px 0;
    text-align: center;
    width: 100%;
    margin-top: 50px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .round-container {
        flex-direction: column;
        align-items: center;
    }

    .round-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 500px;
        position: static;
    }

    .round-image.hide {
        display: block;
        /* บนมือถือไม่จำเป็นต้องซ่อนรูป */
    }

    nav ul {
        gap: 30px;
    }
}

/* แถบสีแดงสำหรับลิงก์ */
.footer-guide-bar {
    background-color: var(--red-main);
    /* ใช้ตัวแปรสีแดงที่คุณตั้งไว้ (#800000) */
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-guide-bar .container {
    display: flex;
    align-items: center;
    gap: 40px;
    /* ระยะห่างระหว่าง 2 ลิงก์ */
    flex-wrap: wrap;
    /* รองรับมือถือ */
    justify-content: center;
}

.guide-link {
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
    text-decoration: none;
    font-size: 30px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.guide-link:hover {
    color: #ffcccc;
    /* เปลี่ยนสีเมื่อเอาเมาส์ไปชี้ */
    transform: translateY(-2px);
}

.footer-icon {
    width: 28px;
    height: auto;
    filter: brightness(0) invert(1);
}

/* เส้นคั่นกลางแนวตั้ง */
.v-line {
    width: 1px;
    height: 25px;
    background-color: rgba(255, 255, 255, 0.3);
}

/* ส่วนรูปภาพ Banner */
.footer-banner {
    line-height: 0;
    /* ป้องกันช่องว่างใต้รูป */
}

.footer-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* ปรับแต่งสำหรับมือถือ */
@media (max-width: 768px) {
    .footer-guide-bar .container {
        flex-direction: column;
        gap: 20px;
    }

    .v-line {
        display: none;
        /* ซ่อนเส้นคั่นบนมือถือ */
    }

    .guide-link {
        font-size: 14px;
    }
}


/* ส่วนรายละเอียดเมนู บังคับซ่อนไว้ก่อน */
.quota-detail-content,
.sub-projects {
    display: none;
}

/* เมื่อมีการสั่งให้โผล่ (ผ่าน JS) ถึงจะแสดง */
.sub-projects.show {
    display: flex !important;
}

/* รูปภาพซ่อนไว้เป็นค่าเริ่มต้น */
.round-image.hide {
    display: none !important;
}

/* =========================
   MOBILE NAVBAR
========================= */
@media (max-width:768px) {
    .main-header {
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    .logo-bar {
        order: 1;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
        padding: 20px 16px 10px;
        background: #8B0000;
    }


    .logo {
        height: 80px;
        width: auto;
    }

    .header-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 20px;
        gap: 15px;
    }

    .header-left {
        flex-direction: column;
        gap: 15px;
    }

    .header-title {
        margin-bottom: 0;
    }

    .header-title h1 {
        font-family: 'Inria Serif', serif;
        font-weight: 700;
        font-size: 18px;
        line-height: 1.3;
        text-align: center;
        color: white;
    }

    .header-right {
        position: static;
        margin-top: 10px;
        text-align: center;
    }

    .top-bar {
        order: 2;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px 16px 20px;
        padding-top: 15px;
        background: #8B0000;
    }

    .top-right {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 4px;
        flex-wrap: wrap;
    }

    .top-right span {
        font-size: 14px;
        color: #f4f4f4;
    }

    nav {
        padding-top: 0;
        /* ปรับเป็น 0 เพื่อให้ชิดขอบบน */
        padding-bottom: 15px;
    }

    nav ul {
        flex-direction: column;
        gap: 18px;
    }

    nav ul li {
        font-size: 16px;
    }

    .hero {
        height: 450px;
    }

    .hero h2 {
        font-size: 28px;
    }



    .dropdown {
        position: relative;
    }

    .dropdown-content {
        position: absolute !important;
        left: 50% !important;
        top: 100% !important;
        transform: translateX(-50%) !important;
        width: 88% !important;
        min-width: 240px !important;

        background: #ffffff !important;
        backdrop-filter: none !important;
        border-radius: 10px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
        padding: 4px 0 !important;
        z-index: 9999 !important;

        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.2s ease, visibility 0.2s ease !important;
        display: block !important;
    }

    .dropdown.open .dropdown-content {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: block !important;
    }

    /* ไม่มีเส้นคั่น */
    .dropdown-content a,
    .dropdown-content div {
        color: #222 !important;
        padding: 16px 22px !important;
        font-size: 15px !important;
        font-weight: 400 !important;
        text-align: left !important;
        display: block !important;
        border: none !important;
        transition: background 0.15s !important;
    }

    .dropdown-content a:hover,
    .dropdown-content div:hover {
        background: #f5f5f5 !important;
        color: #8B0000 !important;
    }

    /* --- ส่วนอื่นๆ --- */
    .hero h2 {
        font-size: 22px;
    }

    .section-title {
        font-size: 18px;
        padding: 10px 18px;
    }

    .content-box {
        font-size: 14px;
        line-height: 1.6;
    }

    .detail-box {
        padding: 20px;
        border-radius: 18px;
    }

    .detail-text h3 {
        font-size: 18px;
    }

    .detail-text p {
        font-size: 14px;
    }

    .footer-guide-bar .container {
        flex-direction: column;
        gap: 20px;
    }

    .v-line {
        display: none;
    }

    .guide-link {
        font-size: 14px;
    }
}

.welcome-button:hover {
    background-color: #8B0000;
    color: white;
    transform: translateY(-2px);
}