/* =========================================================
   - รวมสไตล์ทั้งหมดของเว็บ
   - ควบคุมหน้าตา Navbar, หน้าแรก, Login/Register, Profile, Ranking,
     หน้า Exam, หน้า Summary, หน้า Comment และหน้า Admin
   - ใช้ class ร่วมกันหลายหน้า ดังนั้นถ้าแก้ class ใด class หนึ่ง
     ควรตรวจสอบทุกหน้าที่เรียกใช้ class นั้นด้วย

   โครงสร้างหลักของไฟล์:
   1) Global & Navbar       : พื้นหลังเว็บ เมนูด้านบน ปุ่ม Login/Logout
   2) Home/Index            : หน้าแรกและ hero section
   3) Login/Register        : กล่องฟอร์มเข้าสู่ระบบและสมัครสมาชิก
   4) Profile               : หน้าโปรไฟล์ รูปผู้ใช้ คะแนน และดาว
   5) Ranking               : ตาราง Leaderboard และแถวผู้ใช้ที่ Login อยู่
   6) Comment               : กล่องโพสต์และรายการคอมเมนต์
   7) Admin                 : หน้า Dashboard และปุ่มจัดการของ Admin
   8) Add/Edit Exam          : ฟอร์มเพิ่ม/แก้ไขข้อสอบ จุดรองรับ โหลด และ preview
   9) Exam Question          : หน้าทำข้อสอบ ช่องตอบ และตัวเลือก SFD/BMD
   10) Exam Summary          : หน้าสรุปผล เฉลย และรูปกราฟ
   11) Manage Exam           : ตารางจัดการข้อสอบ แก้ไข/ลบ
   ========================================================= */

/* --- 1. Global & Navbar --- */
/* =========================================================
   GLOBAL RESPONSIVE SETTING
   ========================================================= */


body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

img,
svg,
canvas,
video {
    max-width: 100%;
    height: auto;
}

input,
select,
textarea,
button {
    max-width: 100%;
    font-family: inherit;
}

p,
h1,
h2,
h3,
h4 {
    overflow-wrap: break-word;
}

input,
textarea,
.comment-text,
.delete-question-text,
.delete-answer-line {
    overflow-wrap: anywhere;
}

/* --- 2. Home/Index Page Style --- */
.home-content-wrapper {
    flex: 1;
    padding: 105px 50px 90px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    box-sizing: border-box;
}

.hero-section {
    background: white;
    padding: 50px;
    border-radius: 40px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.05);
    text-align: center;
}

.hero-section h1 {
    color: #4a4e9e;
    font-size: 36px;
    margin-bottom: 30px;
}

.team-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 20px;
    display: inline-block;
    text-align: left;
    margin-bottom: 30px;
    border-left: 5px solid #4a4e9e;
}

.img-shadow {
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15));
    max-width: 100%;
    border-radius: 15px;
}


/* --- 3. สไตล์หน้า Login / Register (เดิมของคุณ) --- */
.auth-page-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 100px; /* เว้นระยะจาก Navbar */
    padding-bottom: 60px;
    box-sizing: border-box;
}
.login-logo img {
    width: 120px; /* ปรับขนาดโลโก้ให้เล็กลงตามความเหมาะสม */
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.form-container h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #4a4e9e;
    font-size: 24px;
}

.login-footer {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

.login-footer a {
    color: #4a4e9e;
    text-decoration: none;
    font-weight: bold;
}

.login-footer a:hover {
    text-decoration: underline;
}
.auth-logo {
    width: 30px; /* ปรับขนาดความกว้างตามต้องการ */
    height: auto;
    margin-bottom: 20px;
}

.form-container {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.input-field {
    width: 100%;
    padding: 14px 15px;
    margin: 10px 0;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #f9faff;
    font-size: 16px;
    box-sizing: border-box;
}

.btn-submit {
    width: 100%;
    padding: 15px;
    background-color: #4a4e9e;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

/* --- 4. หน้า Profile  --- */
.profile-page-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 120px 20px 100px;
}

.full-profile-container {
    background: #DDE1E7; 
    border-radius: 40px;
    padding: 40px;
    width: 100%;
    max-width: 900px;
    box-shadow: 10px 10px 20px #babecc, -10px -10px 20px #ffffff;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.avatar-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    border: 5px solid #fff;
}

.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.upper-dashboard {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: 20px;
    border-bottom: 2px solid #ffffff;
    position: relative;
}

.profile-left {
    text-align: center;
}

.username-tag {
    margin-top: 15px;
    background: #4a4e9e;
    color: white;
    padding: 8px 25px;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 4px 4px 8px #babecc;
}

.divider-v {
    width: 2px;
    height: 120px;
    background: #babecc;
    box-shadow: 1px 0 0 #ffffff;
}

/* ส่วนตารางข้อมูลด้านล่าง */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-box label {
    display: block;
    color: #888;
    font-size: 14px;
    margin-bottom: 8px;
    padding-left: 5px;
}

.info-box .val {
    background: #ffffff;
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: inset 2px 2px 5px #babecc, inset -2px -2px 5px #ffffff;
}

.btn-edit {
    text-decoration: none;
    background: #4a4e9e;
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 500;
    transition: 0.3s;
}
.btn-edit:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(74, 78, 158, 0.3); }

.profile-center {
    display: flex;
    align-items: center;
    gap: 30px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 18px 28px;
    border-radius: 20px;
    box-shadow: 4px 4px 10px #babecc, -4px -4px 10px #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 8px 12px 20px #babecc, -4px -4px 10px #ffffff;
}

.stat-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3436;
}

.stat-label {
    font-size: 0.85rem;
    color: #636e72;
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 70px;
    background: #dfe6e9;
}

.score-hint {
    position: absolute;
    bottom: 18px;
    right: 30px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #e74c3c;
    letter-spacing: 0.3px;
}

/* --- 5. Ranking Page Layout --- */
.main-content-wrapper {
    flex: 1;
    padding-top: 110px;
    padding-bottom: 80px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    padding: 0 45px 15px; /* ปรับ Padding ให้ตรงกับแนวเหรียญรางวัล */
    color: #b2bec3;
    font-weight: 500;
    font-size: 14px;
}

.ranking-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 35px;
    padding: 30px 40px 28px 40px !important;
    width: 92% !important;
    max-width: 750px !important;
    height: auto !important;
    min-height: unset !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    border: 1px solid white;
}

.ranking-container h2 {
    text-align: center;
    color: #2d3436;
    font-size: 28px;
    margin-bottom: 20px !important;
    letter-spacing: 1px;
}


.col-rank { width: 20%; text-align: center; font-weight: 700; }
.col-rank.top-rank { font-size: 45px; } /* ขยายไอคอนให้ใหญ่สะใจ */

.col-name { width: 60%; font-size: 18px; font-weight: 500; }
.col-star { width: 20%; text-align: right; font-weight: 600; font-size: 20px; color: #fdcb6e; }


/* สไตล์ Scrollbar สำหรับ Ranking */

.ranking-list::-webkit-scrollbar { width: 6px; }
.ranking-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

/* =========================================================
   FIX RANKING TABLE: Rank | Username | Score | Stars
   วางท้ายสุดของ style.css
   ========================================================= */

.ranking-list {
    width: 100%;
    max-height: none !important;
    overflow-y: visible !important;
    padding-right: 8px;
    box-sizing: border-box;
}

.rank-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    border-bottom: 2px solid #eeeeee;
}

/* หัวตาราง + แถวข้อมูล ใช้ grid เหมือนกัน */
.rank-header,
.rank-item {
    display: grid !important;
    grid-template-columns: 16% 44% 20% 20% !important;
    align-items: center !important;
    column-gap: 0 !important;
    box-sizing: border-box !important;
}

/* ล้าง width เดิม/inline width เดิม */
.rank-header > div,
.rank-item > div {
    width: auto !important;
    box-sizing: border-box !important;
}

/* Header */
.rank-header {
    padding: 0 30px 12px 30px !important;
    margin-bottom: 15px !important;
    border-bottom: 2px solid #eee !important;
    color: #4a4e9e !important;
    font-weight: 800 !important;
}

/* Row */
.rank-item {
    min-height: 72px;
    padding: 15px 30px !important;
    margin-bottom: 15px;
    border-radius: 20px;
}

/* Column alignment */
.col-rank,
.rank-header > div:nth-child(1) {
    text-align: center !important;
    justify-self: center !important;
    font-weight: 800;
}

.col-name,
.rank-header > div:nth-child(2) {
    text-align: left !important;
    justify-self: start !important;
}

.col-score,
.rank-header > div:nth-child(3) {
    text-align: center !important;
    justify-self: center !important;
    font-weight: 900;
    color: #2563eb;
}

.col-star,
.rank-header > div:nth-child(4) {
    text-align: center !important;
    justify-self: center !important;
    font-weight: 900;
    color: #f59e0b;
}

/* กัน Score / Stars ขึ้นบรรทัดแปลก ๆ */
.col-score,
.col-star {
    white-space: nowrap;
}

/* แถวของเรา */
.rank-item.highlight-me {
    background: #2d3436 !important;
    color: white !important;
    border: 2px solid #EB4343 !important;
}

.rank-item.highlight-me .col-score,
.rank-item.highlight-me .col-star {
    color: white !important;
}

.rank-medal {
    font-size: 34px;
    line-height: 1;
    display: inline-block;
}

/* =========================================================
   RANKING: ทุกแถวเป็นแดงพาสเทลไล่ขาว ยกเว้นคนที่ล็อกอิน
   วางท้ายสุดของ style.css
   ========================================================= */

.ranking-list .rank-item:not(.highlight-me) {
    background: linear-gradient(90deg, #ffbcbc 0%, #ffe0e0 65%, #f1c2c2 100%) !important;
    color: #1f2937 !important;
    border: 1px solid #ffd1d1 !important;
}

/* สีตัวอักษร Score / Stars ของแถวทั่วไป */
.ranking-list .rank-item:not(.highlight-me) .col-score {
    color: #2563eb !important;
}

.ranking-list .rank-item:not(.highlight-me) .col-star {
    color: #f59e0b !important;
}

/* แถวคนที่ล็อกอิน ให้เป็นสีดำเหมือนเดิม */
.ranking-list .rank-item.highlight-me {
    background: #2d3436 !important;
    color: white !important;
    border: 2px solid #EB4343 !important;
}

/* Score / Stars ของคนที่ล็อกอินให้เป็นสีขาว */
.ranking-list .rank-item.highlight-me .col-score,
.ranking-list .rank-item.highlight-me .col-star {
    color: white !important;
}

/* มือถือ */
@media (max-width: 700px) {
    .rank-header,
    .rank-item {
        grid-template-columns: 18% 38% 22% 22% !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
        font-size: 14px;
    }

    .col-name {
        font-size: 15px;
    }
}

/* --- 6.Comment --- */

.comment-feed-container {
    margin-top: 20px;
    max-height: 550px;
    overflow-y: auto;
    padding-right: 10px;
    text-align: left;
}

/* ปรับแต่ง Scrollbar สำหรับ Feed */
.comment-feed-container::-webkit-scrollbar { width: 5px; }
.comment-feed-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

.comment-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 12px 15px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: 0.2s;
}

.comment-card:hover { transform: translateX(5px); }

.comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #f0f2f5;
}

.comment-body { flex: 1; }

.comment-bubble {
    background: #f0f2f5;
    padding: 10px 15px;
    border-radius: 18px;
    display: inline-block;
    max-width: 95%;
}

.comment-user-name {
    font-weight: 700;
    color: #4a4e9e;
    font-size: 13px;
    margin-bottom: 2px;
    display: block;
}

.comment-text {
    font-size: 14px;
    color: #1c1e21;
    line-height: 1.5;
    word-break: break-word;
}

.comment-time {
    font-size: 11px;
    color: #65676b;
    margin-top: 5px;
    padding-left: 10px;
}

/* เน้นคอมเมนต์ที่เป็นของเราเอง */
.my-comment-border {
    border-left: 5px solid #4a4e9e;
    background: #f9faff;
}

/* ส่วนของ Input Area */
.comment-input-box {
    background: white; 
    padding: 20px; 
    border-radius: 25px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    margin-bottom: 25px;
}

/* =========================================================
   COMMENT REPLY SYSTEM
   ========================================================= */

/* ปุ่มตอบกลับใต้คอมเมนต์ */

.comment-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 7px;
    padding-left: 10px;
}

.reply-toggle-btn {
    padding: 0;

    color: #4a4e9e;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;

    background: transparent;
    border: none;

    cursor: pointer;
}

.reply-toggle-btn:hover {
    color: #eb4343;
    text-decoration: underline;
}

.reply-count {
    color: #7b8190;
    font-size: 11px;
    font-weight: 600;
}

/* =========================================================
   รายการข้อความตอบกลับ
   ========================================================= */

.reply-list {
    margin-top: 12px;
    margin-left: 25px;
    padding-left: 14px;

    border-left: 3px solid #dfe4f2;
}

.reply-card {
    display: flex;
    align-items: flex-start;
    gap: 9px;

    margin-bottom: 12px;
}

.reply-avatar {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    object-fit: cover;

    background: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;

    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.12);
}

.reply-content {
    flex: 1;
    min-width: 0;
}

.reply-bubble {
    display: inline-block;

    max-width: 95%;
    padding: 9px 13px;

    background: #eef0f5;
    border-radius: 15px;
}

.reply-user-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;

    margin-bottom: 3px;
}

.reply-username {
    color: #4a4e9e;
    font-size: 12px;
    font-weight: 900;
}

.reply-you-label {
    color: #999;
    font-size: 10px;
    font-weight: 500;
}

/* ป้าย Admin */

.admin-reply-badge {
    padding: 2px 7px;

    color: #ffffff;
    font-size: 9px;
    font-weight: 900;

    background: #eb4343;
    border-radius: 20px;
}

.reply-text {
    color: #252a34;
    font-size: 13px;
    line-height: 1.5;

    white-space: normal;
    overflow-wrap: anywhere;
}

.reply-time {
    margin-top: 4px;
    padding-left: 8px;

    color: #7b8190;
    font-size: 10px;
}

/* =========================================================
   แบบฟอร์มตอบกลับ
   ========================================================= */

.reply-form {
    display: none;

    margin-top: 12px;
    margin-left: 25px;
    padding: 12px;

    background: #f8f9ff;
    border: 1px solid #e0e4f2;
    border-radius: 14px;
}

.reply-form.is-open {
    display: block;
}

.reply-textarea {
    width: 100%;
    min-height: 70px;

    padding: 10px 12px;

    color: #252a34;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;

    resize: vertical;

    background: #ffffff;
    border: 1px solid #d9deeb;
    border-radius: 11px;

    outline: none;
}

.reply-textarea:focus {
    border-color: #4a4e9e;

    box-shadow:
        0 0 0 3px rgba(74, 78, 158, 0.12);
}

.reply-form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    margin-top: 9px;
}

.reply-cancel-btn,
.reply-submit-btn {
    padding: 8px 13px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 800;

    border: none;
    border-radius: 9px;

    cursor: pointer;
}

.reply-cancel-btn {
    color: #4b5563;
    background: #e5e7eb;
}

.reply-cancel-btn:hover {
    background: #d1d5db;
}

.reply-submit-btn {
    color: #ffffff;
    background: #4a4e9e;
}

.reply-submit-btn:hover {
    background: #383d83;
}

/* =========================================================
   หน้าจัดการคอมเมนต์ของ Admin
   ========================================================= */

.admin-comment-card {
    display: block;
    padding: 15px;
}

.admin-comment-main-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.admin-comment-user-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    flex: 1;
    min-width: 0;
}

.admin-delete-comment-btn {
    flex-shrink: 0;

    padding: 8px 15px;

    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;

    background: #eb4343;
    border-radius: 12px;

    transition: 0.25s ease;
}

.admin-delete-comment-btn:hover {
    background: #c92f2f;
    transform: translateY(-2px);
}

/* ปุ่มลบ Reply ของ Admin */

.reply-delete-btn {
    flex-shrink: 0;

    padding: 5px 9px;

    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;

    background: #eb4343;
    border-radius: 8px;
}

.reply-delete-btn:hover {
    background: #c92f2f;
}

/* =========================================================
   Responsive
   ========================================================= */

@media screen and (max-width: 600px) {

    .reply-list,
    .reply-form {
        margin-left: 4px;
    }

    .reply-list {
        padding-left: 9px;
    }

    .reply-bubble {
        max-width: 100%;
    }

    .admin-comment-main-row {
        flex-direction: column;
    }

    .admin-delete-comment-btn {
        align-self: flex-end;
    }

    .reply-card {
        gap: 7px;
    }

    .reply-avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
}

/* =========================================================
   USER COMMENT EDIT / DELETE
   ========================================================= */

.comment-owner-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 5px;
    padding-left: 10px;
}

.comment-owner-edit-btn,
.comment-owner-delete-btn {
    padding: 0;

    font-family: inherit;
    font-size: 11px;
    font-weight: 800;

    background: transparent;
    border: none;

    cursor: pointer;
}

.comment-owner-edit-btn {
    color: #4a4e9e;
}

.comment-owner-edit-btn:hover {
    text-decoration: underline;
}

.comment-owner-delete-btn {
    color: #eb4343;
}

.comment-owner-delete-btn:hover {
    text-decoration: underline;
}

.comment-owner-delete-form {
    display: inline;
    margin: 0;
}

/* แบบฟอร์มแก้ไข */

.comment-edit-form {
    display: none;

    margin-top: 10px;
    margin-left: 10px;
    padding: 12px;

    background: #f8f9ff;
    border: 1px solid #dfe4f2;
    border-radius: 14px;
}

.comment-edit-form.is-open {
    display: block;
}

.comment-edit-textarea {
    width: 100%;
    min-height: 75px;

    padding: 10px 12px;

    color: #252a34;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;

    resize: vertical;

    background: #ffffff;
    border: 1px solid #d9deeb;
    border-radius: 10px;

    outline: none;
}

.comment-edit-textarea:focus {
    border-color: #4a4e9e;

    box-shadow:
        0 0 0 3px rgba(74, 78, 158, 0.12);
}

.comment-edit-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    margin-top: 9px;
}

.comment-edit-cancel-btn,
.comment-edit-save-btn {
    padding: 7px 12px;

    font-family: inherit;
    font-size: 11px;
    font-weight: 800;

    border: none;
    border-radius: 8px;

    cursor: pointer;
}

.comment-edit-cancel-btn {
    color: #4b5563;
    background: #e5e7eb;
}

.comment-edit-cancel-btn:hover {
    background: #d1d5db;
}

.comment-edit-save-btn {
    color: #ffffff;
    background: #4a4e9e;
}

.comment-edit-save-btn:hover {
    background: #383d83;
}

/* ปุ่มของ Reply */

.reply-owner-actions {
    margin-top: 4px;
    padding-left: 8px;
}

.reply-content .comment-edit-form {
    margin-left: 0;
}

/* มือถือ */

@media screen and (max-width: 600px) {

    .comment-edit-form {
        margin-left: 0;
    }

    .comment-owner-actions {
        padding-left: 5px;
    }
}

/* --- 7. Admin */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.admin-card {
    background: #ffffff;
    padding: 40px 20px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #EB4343; /* ใช้สีแดงตามสไตล์ที่คุณชอบ */
}

.admin-icon {
    font-size: 60px;
    margin-bottom: 20px;
    display: block;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.1));
}

.admin-card h3 {
    color: #4a4e9e;
    font-size: 22px;
    margin-bottom: 12px;
}

.admin-card p {
    color: #7f8c8d;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

/* ตกแต่งส่วนหัวของหน้า Dashboard */
.admin-header-text {
    text-align: center;
    margin-bottom: 40px;
}

.admin-header-text h1 {
    color: #4a4e9e;
    font-size: 32px;
    margin-bottom: 10px;
}

.admin-header-text p {
    color: #888;
}

/* สถานะแอดมินบน Navbar */
.admin-status {
    color: white;
    margin-right: 20px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
}

/* admin*/
    .form-exam { background: white; padding: 30px; border-radius: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
    .input-group { margin-bottom: 20px; }
    .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: #4a4e9e; }
    .input-exam { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 10px; font-size: 16px; box-sizing: border-box; }
    .textarea-exam { height: 150px; resize: vertical; }
    .choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

    /*หน้าเพิ่มข้อสอบ*/
/* ==========================================================================
   📐 ระบบจัดหน้าจอสองฝั่งแบบยืดหยุ่น (ป้องกันหน้าจอเบี้ยวและปุ่มหาย)
   ========================================================================== */
.admin-layout {
    display: flex;
    flex-direction: row;
    gap: 25px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    min-height: 620px;
    padding-bottom: 120px;
}

.form-section {
    flex: 1;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.preview-section {
    flex: 1.3;
    min-width: 0 !important;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #ddd;
    box-sizing: border-box !important;
}

/* =========================================================
   FORM LAYOUT
   ========================================================= */

.load-item {
    display: grid !important;
    gap: 18px 16px !important;
    align-items: end !important;
    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;
    border-radius: 16px !important;
    padding: 22px !important;
    margin-bottom: 22px !important;
    box-sizing: border-box !important;
}

/* =========================================================
   FORM LAYOUT CLEAN
   ========================================================= */


#load_container,
#support_container{
    display:flex;
    flex-direction:column;
    gap:18px;
}

/* =========================
   CARD
   ========================= */

.load-item > div{
    min-width:0;

    display:flex;
    flex-direction:column;

    gap:8px;
}

.load-item label{
    font-size:15px;
    font-weight:800;
    line-height:1.35;

    color:#111827;

    margin-bottom:4px;
}

.load-item input,
.load-item select,
.load-item .input-exam{
    width:100%;
    height:48px;

    padding:0 13px;

    border:1px solid #d9dee8;
    border-radius:10px;

    font-size:15px;
    box-sizing:border-box;

    background:#fff;
}

.load-item button{
    width:38px;
    height:38px;

    display:flex;
    align-items:center;
    justify-content:center;

    margin-top:0 !important;
}

/* =========================
   SUPPORT
   ========================= */

.support-item{
    grid-template-columns:
        1fr
        1fr
        42px;
}

/* =========================
   LOAD
   ========================= */

.beam-load-item{
    display:grid;

    grid-template-columns:
        1.3fr
        1fr
        1fr;

    gap:18px 16px;
    align-items:end;
}

/* ===== ROW 1 ===== */

.beam-load-item > div:nth-child(1){
    grid-column:1;
    grid-row:1;
}

.beam-load-item > div:nth-child(2){
    grid-column:2;
    grid-row:1;
}

.beam-load-item > div:nth-child(3){
    grid-column:3;
    grid-row:1;
}

/* ===== ROW 2 ===== */

.beam-load-item > div:nth-child(4){
    grid-column:1;
    grid-row:2;
}

.beam-load-item > div:nth-child(5){
    grid-column:2;
    grid-row:2;
}

/* ===== DELETE ===== */

.beam-load-item > div:last-child{
    grid-column:3;
    grid-row:2;

    align-self:center;
    justify-self:start;
}

/* =========================
   HIDE UNUSED FIELDS
   ========================= */

.point-fields[style*="display: none"],
.dist-fields[style*="display: none"],
.trap-fields[style*="display: none"],
.moment-fields[style*="display: none"]{
    display:none !important;
}

/* =========================================================
   ปุ่มไปหน้าลบข้อสอบ หน้า Add Exam
   ========================================================= */

/* =========================================================
   ปุ่มไปหน้าลบข้อสอบ หน้า Add Exam
   ========================================================= */

/* =========================================================
   ปุ่มคำสั่งหน้า Add Exam
   ========================================================= */

.admin-action-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 22px;
    box-sizing: border-box;
}

.admin-action-btn {
    width: 100%;
    min-height: 56px;
    padding: 14px;
    border: none;
    border-radius: 8px;

    color: white;
    font-size: 15px;
    font-weight: bold;
    font-family: inherit;

    cursor: pointer;
    box-sizing: border-box;
    transition: 0.25s ease;
}

.admin-action-btn:hover {
    transform: translateY(-2px);
}

/* ปุ่มวิเคราะห์ */
.analyze-btn {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 6px 14px rgba(34, 197, 94, 0.25);
}

/* ปุ่มบันทึก */
.save-btn {
    background: #766092;
    box-shadow: 0 6px 14px rgba(235, 67, 67, 0.25);
}

/* ปุ่มไปหน้าลบข้อสอบ ให้เต็มแถว */
.delete-page-btn {
    grid-column: 1 / -1;
    background: #EB4343;
    box-shadow: 0 6px 14px rgba(118, 96, 146, 0.25);
}

.delete-page-btn:hover {
    background: #EB4343;
}

/* =========================
   MOBILE
   ========================= */

@media(max-width:700px){

    .support-item,
    .beam-load-item{
        grid-template-columns:1fr;
    }

    .beam-load-item > div,
    .support-item > div,
    .beam-load-item > div:last-child{
        grid-column:1;
        grid-row:auto;
    }
}

/* ===== FIX ORDER FOR UNIFORM DISTRIBUTED LOAD ===== */

/* Distributed Load:
   แถวบน: ประเภทแรง | แรงกระจาย w
   แถวล่าง: เริ่มต้น | สิ้นสุด | ถังขยะ
*/
.beam-load-item:has(.dist-fields:not([style*="display: none"])) > div:nth-child(1) {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

.beam-load-item:has(.dist-fields:not([style*="display: none"])) .dist-fields:nth-of-type(4) {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

.beam-load-item:has(.dist-fields:not([style*="display: none"])) .dist-fields:nth-of-type(5) {
    grid-column: 1 !important;
    grid-row: 2 !important;
}

.beam-load-item:has(.dist-fields:not([style*="display: none"])) .dist-fields:nth-of-type(6) {
    grid-column: 2 !important;
    grid-row: 2 !important;
}

.beam-load-item:has(.dist-fields:not([style*="display: none"])) > div:last-child {
    grid-column: 3 !important;
    grid-row: 2 !important;
}

.result-divider {
    margin: 22px 0 12px;
    padding: 10px 14px;
    border-top: 2px solid #dbe4f0;
    border-bottom: 2px solid #dbe4f0;
    color: #334155;
    background: #f8fafc;
    font-weight: 800;
    text-align: center;
    border-radius: 10px;
}

.result-section {
    padding-top: 10px;
    margin-bottom: 12px;
    border-bottom: 1px dashed #cbd5e1;
}

.result-section:last-child {
    border-bottom: none;
}

/* EXAM QUESTION PAGE */

.exam-page-wrapper {
    flex: 1;
    padding-top: 110px;
    padding-bottom: 90px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.exam-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 35px;
    padding: 40px;
    width: 90%;
    max-width: 780px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    border: 1px solid white;
}

.exam-container h2 {
    text-align: center;
    color: #2d3436;
    font-size: 28px;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

.exam-progress {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 14px 20px;
    border-radius: 18px;
    margin-bottom: 25px;
    color: #4a4e9e;
    font-weight: 700;
}

.question-card {
    background: #ffffff;
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
}

.beam-box {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.beam-placeholder {
    width: 100%;
    min-height: 130px;
    background: linear-gradient(135deg, #eef3ff, #ffffff);
    border: 2px dashed #aab6ff;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4e9e;
    font-weight: 700;
    text-align: center;
    padding: 20px;
}

.question-card h3 {
    color: #4a4e9e;
    font-size: 22px;
    margin-bottom: 12px;
}

.question-card p {
    color: #333;
    font-size: 17px;
    line-height: 1.7;
}

.answer-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 25px;
    margin-bottom: 14px;
}

.answer-box label {
    font-weight: 700;
    color: #4a4e9e;
}

.answer-box input {
    flex: 1;
    padding: 13px 15px;
    border: 1px solid #ddd;
    border-radius: 14px;
    font-size: 16px;
    outline: none;
}

.answer-box input:focus {
    border-color: #4a4e9e;
    box-shadow: 0 0 0 3px rgba(74,78,158,0.15);
}

.unit {
    font-weight: 700;
    color: #666;
}

.result-message {
    margin-top: 18px;
    font-weight: 700;
    min-height: 24px;
}

.result-message.correct {
    color: #00b894;
}

.result-message.wrong {
    color: #d63031;
}

.result-message.warning {
    color: #e17055;
}

.exam-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 28px;
}

.btn-exam {
    flex: 1;
    border: none;
    padding: 13px 18px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.25s ease;
}

.btn-disabled,
.btn-exam:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.btn-exam:hover {
    transform: translateY(-3px);
}

.btn-exam.primary {
    background: #4a4e9e;
    color: white;
}

.btn-exam.secondary {
    background: #dfe6e9;
    color: #2d3436;
}

.btn-exam.check {
    background: #fdcb6e;
    color: #2d3436;
}

.btn-exam.finish-mode {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
}

.answer-hint {
    display: block;
    width: 100%;
    margin: 6px 0 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #7c3aed;
    background: #f5f3ff;
    border-left: 4px solid #7c3aed;
    padding: 6px 10px;
    border-radius: 8px;
}

@media (max-width: 700px) {
    .exam-container {
        padding: 25px;
    }

    .exam-progress {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .answer-box {
        flex-direction: column;
        align-items: stretch;
    }

    .exam-buttons {
        flex-direction: column;
    }
}

.beam-preview-img {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 16px;
}

#answerInputs {
    margin-top: 25px;
}


.sfd-bmd-images {
    margin-top: 25px;
    margin-bottom: 25px;
}

.diagram-section-title {
    margin: 22px 0 12px;
    padding: 10px 16px;
    border-radius: 16px;
    background: #eef2ff;
    color: #29367d;
    font-weight: 800;
    text-align: center;
}

.diagram-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.diagram-card {
    background: #ffffff;
    border: 1px solid #e5e7f3;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.05);
}

.diagram-label {
    font-weight: 800;
    color: #4a4e9e;
    margin-bottom: 10px;
    text-align: center;
}

.diagram-img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 12px;
}

.choice-card {
    cursor: pointer;
    transition: 0.25s ease;
}

.choice-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.diagram-choice-input {
    margin-bottom: 10px;
    transform: scale(1.2);
}

.choice-correct {
    border: 3px solid #00b894 !important;
    background: #e8fff8;
}

.choice-wrong {
    border: 3px solid #d63031 !important;
    background: #ffecec;
}



@media (max-width: 800px) {
    .diagram-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   EXAM SUMMARY PAGE
   ========================================================= */

.exam-summary-wrapper {
    flex: 1;
    padding-top: 110px;
    padding-bottom: 95px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.exam-summary-container {
    background: rgba(255,255,255,0.92);
    border-radius: 35px;
    padding: 40px;
    width: 90%;
    max-width: 950px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    border: 1px solid white;
}

.exam-summary-container h2 {
    text-align: center;
    color: #2d3436;
    font-size: 28px;
    margin-bottom: 25px;
}

.summary-score-box {
    background: linear-gradient(135deg, #4a4e9e, #7791bc);
    color: white;
    border-radius: 25px;
    padding: 25px;
    text-align: center;
    margin-bottom: 30px;
}

.summary-score-label {
    font-size: 16px;
    opacity: 0.9;
}

.summary-score {
    font-size: 42px;
    font-weight: 900;
    margin-top: 8px;
}

.summary-stars {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 900;
}

.summary-card {
    background: white;
    border-radius: 24px;
    padding: 25px;
    margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    border: 2px solid #f0f0f0;
}

.summary-card.correct {
    border-color: #00b894;
}

.summary-card.wrong {
    border-color: #d63031;
}

.summary-card h3 {
    color: #4a4e9e;
    margin-bottom: 10px;
}

.summary-status {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 20px;
    font-weight: 800;
    margin-bottom: 15px;
    background: #f1f2f6;
    color: #2d3436;
}

.summary-card.correct .summary-status {
    background: #dffaf2;
    color: #00b894;
}

.summary-card.wrong .summary-status {
    background: #ffe5e5;
    color: #d63031;
}

.summary-beam-img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 18px;
    margin: 15px 0;
    border: 1px solid #eef2ff;
}

.summary-question {
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    margin: 12px 0;
}

.summary-answer-box {
    background: #f8f9fa;
    border-radius: 18px;
    padding: 18px;
    margin-top: 15px;
}

.summary-answer-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 10px;
    font-size: 15px;
}

.summary-answer-row.correct-line {
    background: #e8fff8;
    color: #008f72;
}

.summary-answer-row.wrong-line {
    background: #ffecec;
    color: #d63031;
}

.summary-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.summary-btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
    padding: 14px 18px;
    border-radius: 18px;
    font-weight: 800;
    transition: 0.25s ease;
}

.summary-btn:hover {
    transform: translateY(-3px);
}

.summary-btn.primary {
    background: #4a4e9e;
    color: white;
}

.summary-btn.secondary {
    background: #dfe6e9;
    color: #2d3436;
}

.summary-card.partial {
    border-color: #fdcb6e;
}

.summary-card.partial .summary-status {
    background: #fff4d6;
    color: #b7791f;
}

@media (max-width: 700px) {
    .summary-buttons {
        flex-direction: column;
    }

    .summary-answer-row {
        grid-template-columns: 1fr;
    }

    .exam-summary-container {
        padding: 25px;
    }
}

/* เฉลยให้เป็นสีเขียว */
.summary-correct-answer {
    color: #00a878;
    font-weight: 700;
}

.summary-correct-answer span {
    color: #00a878;
    font-weight: 800;
}

/* คำว่า คำตอบของคุณ / เฉลย ให้หนาขึ้น */
.summary-answer-row strong {
    font-weight: 900;
}

/* รูปเฉลย SFD/BMD */
.summary-correct-img-wrap {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
    background: #f0fff8;
    border: 1px solid #b8f5d0;
}

.summary-correct-img-title {
    font-weight: 900;
    color: #00a878;
    margin-bottom: 10px;
    text-align: center;
}

.summary-correct-img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 14px;
    background: white;
}

/* รูปตัวเลือกทั้งหมดในหน้า Summary */

.summary-diagram-section {
    margin: 20px 0;
    padding: 16px;
    border-radius: 20px;
    background: #f8faff;
    border: 1px solid #e2e8ff;
}

.summary-diagram-title {
    text-align: center;
    font-weight: 900;
    color: #4a4e9e;
    margin-bottom: 14px;
}

.summary-diagram-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.summary-diagram-card {
    background: white;
    border: 2px solid #edf0f7;
    border-radius: 16px;
    padding: 10px;
}

.summary-diagram-correct {
    border-color: #00b894;
    background: #e8fff8;
}

.summary-diagram-label {
    text-align: center;
    font-weight: 800;
    color: #4a4e9e;
    margin-bottom: 8px;
}

.summary-diagram-correct .summary-diagram-label {
    color: #00a878;
}

.summary-diagram-img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 12px;
    background: white;
}

@media (max-width: 800px) {
    .summary-diagram-grid {
        grid-template-columns: 1fr;
    }
}

/* Summary: แสดงเฉพาะรูปที่เลือก + รูปเฉลย แบบเรียงลงมา */

.summary-diagram-answer-list {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 14px;
}

.summary-selected-diagram-card {
    width: 100%;
    padding: 14px;
    border-radius: 18px;
    background: white;
    border: 2px solid #edf0f7;
    box-sizing: border-box;
}

.summary-selected-diagram-card.selected-correct {
    background: #e8fff8;
    border-color: #00b894;
}

.summary-selected-diagram-card.selected-wrong {
    background: #ffecec;
    border-color: #d63031;
}

.summary-selected-title {
    text-align: center;
    font-weight: 900;
    margin-bottom: 12px;
}

.summary-selected-diagram-card.selected-correct .summary-selected-title {
    color: #00a878;
}

.summary-selected-diagram-card.selected-wrong .summary-selected-title {
    color: #d63031;
}


.summary-section-title {
    margin: 18px 0 12px 0;
    padding: 10px 16px;
    border-radius: 16px;
    background: #eef2ff;
    color: #29367d;
    font-weight: 900;
    font-size: 16px;
    text-align: center;
    grid-column: 1 / -1;
}


.summary-selected-diagram-img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 14px;
    background: white;
    display: block;
}



/* =========================================================
   หน้า Manage Exam
   ========================================================= */

.delete-exam-wrapper {
    flex: 1;
    padding-top: 110px;
    padding-bottom: 95px;
    width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.delete-exam-container {
    width: 92%;
    max-width: 1250px;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 30px;
    padding: 35px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    border: 1px solid white;
    box-sizing: border-box;
}

.delete-exam-container h2 {
    text-align: center;
    color: #2d3436;
    font-size: 28px;
    margin-bottom: 25px;
}

.delete-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.delete-back-btn {
    display: inline-block;
    background: #766092;
    color: white;
    padding: 11px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(118,96,146,0.22);
    transition: 0.25s ease;
}

.delete-back-btn:hover {
    background: #654f80;
    transform: translateY(-2px);
}

.delete-search-box {
    width: 300px;
    max-width: 100%;
    padding: 11px 14px;
    border: 1px solid #d9dee8;
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
}

.delete-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
}

.delete-exam-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.delete-exam-table th {
    background: #EB4343;
    color: white;
    padding: 13px;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

.delete-exam-table td {
    padding: 13px;
    border-bottom: 1px solid #eeeeee;
    vertical-align: top;
    font-size: 14px;
}

.delete-exam-table tr:hover {
    background: #fff5f5;
}

.delete-question-text {
    max-width: 430px;
    white-space: normal;
    line-height: 1.5;
}

.delete-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 9px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: 0.25s ease;
}

.delete-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.delete-status-active {
    color: #16a34a;
    font-weight: 900;
}

.delete-status-inactive {
    color: #dc2626;
    font-weight: 900;
}

.delete-empty {
    text-align: center;
    padding: 25px;
    color: #777;
    font-weight: 700;
}

@media (max-width: 768px) {
    .delete-exam-container {
        padding: 24px;
    }

    .delete-top-bar {
        align-items: stretch;
    }

    .delete-back-btn,
    .delete-search-box {
        width: 100%;
        text-align: center;
    }

    .delete-exam-table th,
    .delete-exam-table td {
        padding: 10px;
        font-size: 12px;
    }
}

/* ADMIN MANAGEMENT BUTTONS & TABLES (เพิ่มใหม่สำหรับหน้าจัดการข้อสอบ) */
.btn-edit-custom {
    background-color: #ffb142;
    color: white;
    padding: 7px 16px;
    border-radius: 6px;
    text-decoration: none;
    margin-right: 6px;
    font-size: 14px;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 3px 6px rgba(255, 177, 66, 0.3);
}

.btn-edit-custom:hover {
    background-color: #ff9f1a;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(255, 177, 66, 0.4);
}

.btn-delete-custom {
    background-color: #ff5252;
    color: white;
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s ease;
    box-shadow: 0 3px 6px rgba(255, 82, 82, 0.3);
}

.btn-delete-custom:hover {
    background-color: #ff3838;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(255, 82, 82, 0.4);
}

.action-cell {
    text-align: center;
    white-space: nowrap;
}

/* =========================================================
   FORMAT all_answers ในหน้า Manage Exam
   ========================================================= */

.delete-answer-text {
    max-width: 360px;
    max-height: 150px;
    overflow-y: auto;
    background: #f8f9ff;
    border: 1px solid #e0e4f0;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.65;
    color: #2d3436;
    box-sizing: border-box;
}

.delete-answer-line {
    display: block;
    margin-bottom: 4px;
    word-break: break-word;
}

.delete-answer-title {
    display: block;
    margin-top: 7px;
    margin-bottom: 3px;
    font-weight: 900;
    color: #4a4e9e;
}

.delete-answer-sub {
    display: block;
    padding-left: 12px;
    margin-bottom: 3px;
    word-break: break-word;
}

.answer-section-title {
    margin: 22px 0 14px 0 !important;
    padding: 10px 16px !important;
    border-radius: 16px !important;
    background: #eef2ff !important;
    color: #29367d !important;
    font-weight: 800 !important;
    font-size: 16px !important;
    text-align: center !important;
    border-left: none !important;
}


/* =========================================================
   ADMIN EDIT EXAM PAGE
   แก้ปัญหาหน้า Edit Exam โดนบีบเพราะใช้ ranking-container
   ========================================================= */

.admin-edit-container {
    width: 92%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 35px;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    border: 1px solid white;
    box-sizing: border-box;
}

.admin-edit-container .admin-layout {
    display: flex;
    flex-direction: row;
    gap: 25px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.admin-edit-container .form-section {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.admin-edit-container .preview-section {
    flex: 1.35;
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .admin-edit-container .admin-layout {
        flex-direction: column;
    }

    .admin-edit-container .form-section,
    .admin-edit-container .preview-section {
        width: 100%;
    }
}

/* =========================================================
   NAVBAR และ FOOTER ชุดกลางสำหรับทุกหน้า
   วางท้ายสุดของ style.css
   ========================================================= */

/* ---------------------------------------------------------
   ป้องกันขนาดกล่องล้น
   --------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-height: 100vh;

    margin: 0;
    padding: 0 0 70px;

    display: flex;
    flex-direction: column;

    overflow-x: hidden;

    font-family: 'Kanit', sans-serif;

    background: linear-gradient(
        135deg,
        #f4f7fb 0%,
        #c3cfe2 100%
    );
}

/* ---------------------------------------------------------
   HEADER
   --------------------------------------------------------- */

.site-header {
    width: 100%;
    position: relative;
    z-index: 5000;
    overflow: visible;
}

/* ---------------------------------------------------------
   NAVBAR หลัก
   --------------------------------------------------------- */

.site-navbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 6000;

    width: 100%;
    min-height: 76px;

    padding: 10px 34px;

    display: grid;
    grid-template-columns:
        minmax(80px, 1fr)
        auto
        minmax(180px, 1fr);

    align-items: center;
    gap: 24px;

    background: linear-gradient(
        135deg,
        #c2d6f5 0%,
        #7791bc 55%,
        #40577c 100%
    );

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.15);
    overflow: visible;
}

/* ---------------------------------------------------------
   LOGO
   --------------------------------------------------------- */

.site-navbar-logo {
    justify-self: start;

    width: 78px;
    max-width: 78px;

    display: flex;
    align-items: center;
    justify-content: flex-start;

    flex-shrink: 0;
    text-decoration: none;
}

.site-navbar-logo img {
    display: block !important;

    width: 70px !important;
    max-width: 70px !important;

    height: 54px !important;
    max-height: 54px !important;

    object-fit: contain !important;

    transition: transform 0.25s ease;
}


/* ---------------------------------------------------------
   เมนูตรงกลาง
   --------------------------------------------------------- */

.site-nav-center {
    justify-self: center;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 30px;

    white-space: nowrap;
}

/* Admin มีรายการเยอะกว่า ลดช่องว่างเล็กน้อย */

.site-admin-nav {
    gap: 22px;
}

.site-nav-link {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 8px 5px;

    color: #35155d;

    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;

    text-decoration: none;

    transition:
        color 0.2s ease,
        transform 0.2s ease;
}

.site-nav-link::after {
    content: "";

    position: absolute;
    left: 50%;
    bottom: 2px;

    width: 0;
    height: 3px;

    background: #ffffff;
    border-radius: 4px;

    transform: translateX(-50%);

    transition: width 0.25s ease;
}

.site-nav-link:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.site-nav-link:hover::after {
    width: 100%;
}

/* ---------------------------------------------------------
   เมนูที่กำลังเปิดอยู่ เป็นสีแดง
   --------------------------------------------------------- */

.site-nav-link.is-active {
    color: #eb4343 !important;
    font-weight: 900;
}

.site-nav-link.is-active::after {
    width: 100%;
    background: #eb4343;
}

/* ---------------------------------------------------------
   ปุ่มฝั่งขวา
   --------------------------------------------------------- */

.site-nav-actions {
    justify-self: end;

    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 10px;
}

/* ---------------------------------------------------------
   ปุ่ม Profile
   --------------------------------------------------------- */

.site-profile-button {
    min-width: 0;
    max-width: 230px;
    min-height: 46px;

    padding: 7px 15px 7px 8px;

    display: flex;
    align-items: center;
    gap: 8px;

    color: #4a4e9e;
    text-decoration: none;

    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 28px;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.site-profile-button:hover {
    transform: translateY(-2px);
    background: #f6f7ff;
}

.site-profile-icon {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #eef2ff;
    border-radius: 50%;

    font-size: 17px;
}

.site-profile-name {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 14px;
    font-weight: 800;
}

/* Profile เป็นหน้า Active */

.site-profile-button.is-active {
    color: #ffffff;

    background: #eb4343;
    border-color: #ff8b8b;
}

.site-profile-button.is-active .site-profile-icon {
    background: rgba(255, 255, 255, 0.22);
}

/* ---------------------------------------------------------
   ผู้ดูแลระบบ
   --------------------------------------------------------- */

.site-admin-user {
    min-width: 0;
    max-width: 260px;
    min-height: 46px;

    padding: 8px 15px;

    display: flex;
    align-items: center;
    gap: 5px;

    color: #4a4e9e;

    background: #ffffff;
    border-radius: 25px;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12);
}

.site-admin-user-label {
    flex-shrink: 0;

    font-size: 13px;
    font-weight: 700;
}

.site-admin-user-name {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 14px;
    font-weight: 900;
}

/* ---------------------------------------------------------
   Logout
   --------------------------------------------------------- */

.site-logout-button {
    min-height: 46px;
    padding: 10px 20px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;

    background: linear-gradient(
        135deg,
        #eb4343,
        #ff5964
    );

    border-radius: 25px;

    box-shadow:
        0 5px 13px rgba(235, 67, 67, 0.27);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.site-logout-button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 17px rgba(235, 67, 67, 0.35);
}

/* ---------------------------------------------------------
   Login และ Register
   --------------------------------------------------------- */

.site-login-button,
.site-register-button {
    min-height: 44px;
    padding: 10px 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;

    border-radius: 24px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.site-login-button {
    color: #4a4e9e;
    background: #ffffff;
}

.site-register-button {
    color: #ffffff;
    background: #4a4e9e;
}

.site-login-button:hover,
.site-register-button:hover {
    transform: translateY(-2px);
}

/* Login หรือ Register ที่กำลังเปิดอยู่ */

.site-login-button.is-active,
.site-register-button.is-active {
    color: #ffffff;
    background: #eb4343;
}

/* ---------------------------------------------------------
   HAMBURGER ซ่อนบนคอม
   --------------------------------------------------------- */

.site-mobile-toggle {
    display: none;
}

/* ---------------------------------------------------------
   OVERLAY ซ่อนบนคอม
   --------------------------------------------------------- */

.site-mobile-overlay {
    display: none;
    pointer-events: none;
}

.site-mobile-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 4500;

    width: 100%;
    min-height: 58px;
    padding: 12px 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;
    text-align: center;

    background: linear-gradient(
        135deg,
        #7791bc 0%,
        #c2d6f5 100%
    );

    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
}

.site-footer-text {
    margin: 0;

    color: #ffffff !important;

    font-family: sans-serif;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0.5px;
}

/* =========================================================
   TABLET
   ========================================================= */

@media screen and (max-width: 1180px) {

    .site-navbar {
        padding-left: 20px;
        padding-right: 20px;
        overflow: visible;
        gap: 15px;
    }

    .site-nav-center {
        gap: 18px;
        overflow: visible;
    }

    .site-admin-nav {
        gap: 13px;
    }

    .site-nav-link {
        font-size: 15px;
    }

    .site-profile-button {
        max-width: 170px;
    }

    .site-admin-user {
        max-width: 210px;
    }

    .site-logout-button {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media screen and (max-width: 900px) {

    /* -----------------------------------------------------
       NAVBAR
       ----------------------------------------------------- */

    .site-navbar {
        height: 72px;
        min-height: 72px;
        overflow: visible;
        padding: 8px 12px;

        display: flex;
        align-items: center;
        justify-content: flex-start;

        gap: 8px;
    }

    .site-navbar-logo {
        width: 60px;
        max-width: 60px;
        flex: 0 0 60px;
    }

    .site-navbar-logo img {
        width: 56px !important;
        max-width: 56px !important;

        height: 46px !important;
        max-height: 46px !important;
    }

    /* -----------------------------------------------------
       เมนูตรงกลาง กลายเป็นแผงเลื่อนลง
       ----------------------------------------------------- */

    .site-nav-center {
        position: fixed;
        top: 72px;
        left: 0;
        z-index: 5200;
        

        width: 100%;
        max-height: calc(100dvh - 72px);

        padding: 13px 12px 18px;

        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 7px;

        background: rgba(255, 255, 255, 0.98);

        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.18);
        overflow-x: hidden;
        overflow-y: auto;

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transform: translateY(-15px);

        transition:
            opacity 0.25s ease,
            visibility 0.25s ease,
            transform 0.25s ease;
    }

    .site-nav-center.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;

        transform: translateY(0);
    }

    .site-nav-link {
        width: 100%;
        min-height: 50px;

        padding: 12px 15px;

        display: flex;
        align-items: center;
        justify-content: flex-start;

        color: #354052;
        font-size: 16px;
        text-align: left;

        background: #f6f7fb;
        border-radius: 13px;
    }

    .site-nav-link::after {
        display: none;
    }

    .site-nav-link:hover {
        color: #4a4e9e;
        background: #e9edff;
        transform: none;
    }

    .site-nav-link.is-active {
        color: #ffffff !important;
        background: #eb4343;
    }

    /* -----------------------------------------------------
       ปุ่มฝั่งขวา
       ยังคงแสดง Profile และ Logout บน Navbar
       ----------------------------------------------------- */

    .site-nav-actions {
        min-width: 0;
        margin-left: auto;

        gap: 6px;
    }

    .site-profile-button {
        max-width: 145px;
        min-height: 42px;

        padding: 5px 9px 5px 5px;
    }

    .site-profile-icon {
        width: 29px;
        height: 29px;
        flex-basis: 29px;

        font-size: 15px;
    }

    .site-profile-name {
        font-size: 12px;
    }

    .site-admin-user {
        max-width: 170px;
        min-height: 42px;

        padding: 6px 9px;
    }

    .site-admin-user-label {
        display: none;
    }

    .site-admin-user-name::before {
        content: "Admin: ";
        font-weight: 700;
    }

    .site-admin-user-name {
        font-size: 12px;
    }

    .site-logout-button {
        min-height: 42px;

        padding: 8px 11px;

        font-size: 12px;
    }

    .site-login-button,
    .site-register-button {
        min-height: 42px;

        padding: 8px 12px;

        font-size: 12px;
    }

    /* -----------------------------------------------------
       HAMBURGER
       ----------------------------------------------------- */

    .site-mobile-toggle {
        position: relative;
        z-index: 6200;

        pointer-events: auto;
        touch-action: manipulation;

        -webkit-tap-highlight-color: transparent;
        width: 43px;
        height: 43px;

        flex: 0 0 43px;

        padding: 9px;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;

        background: #ffffff;

        border: none;
        border-radius: 13px;

        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.13);

        cursor: pointer;
    }

    .site-mobile-toggle span {
        display: block;

        width: 23px;
        height: 3px;

        background: #4a4e9e;
        border-radius: 4px;

        transition:
            opacity 0.25s ease,
            transform 0.25s ease;
    }

    /* เปลี่ยน Hamburger เป็น X */

    .site-mobile-toggle.is-open span:nth-child(1) {
        transform:
            translateY(8px)
            rotate(45deg);
    }

    .site-mobile-toggle.is-open span:nth-child(2) {
        opacity: 0;
    }

    .site-mobile-toggle.is-open span:nth-child(3) {
        transform:
            translateY(-8px)
            rotate(-45deg);
    }

    /* -----------------------------------------------------
       พื้นหลังมืด
       ----------------------------------------------------- */

    .site-mobile-overlay {
        position: fixed;
        top: 72px;
        right: 0;
        bottom: 0;
        left: 0;

        z-index: 4900;

        display: block;

        background: rgba(17, 24, 39, 0.45);

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transition:
            opacity 0.25s ease,
            visibility 0.25s ease;
    }

    .site-mobile-overlay.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.site-menu-open {
        overflow: hidden;
    }

    /* -----------------------------------------------------
       เนื้อหาทุกหน้าต้องไม่โดน Navbar บัง
       ----------------------------------------------------- */

    .main-content-wrapper,
    .exam-page-wrapper,
    .exam-summary-wrapper,
    .delete-exam-wrapper {
        padding-top: 92px;
    }

    .profile-page-wrapper,
    .auth-page-wrapper,
    .home-content-wrapper {
        padding-top: 92px;
    }

    /* -----------------------------------------------------
       FOOTER MOBILE
       ----------------------------------------------------- */

    .site-footer {
        padding: 15px 12px;
    }

    .site-footer-text {
        font-size: 13px;
    }
}


/* =========================================================
   โทรศัพท์จอเล็ก
   ========================================================= */

@media screen and (max-width: 520px) {

    .site-navbar {
        padding-left: 7px;
        padding-right: 7px;
        gap: 5px;
        overflow: visible;
    }

    .site-navbar-logo {
        width: 50px;
        max-width: 50px;
        flex-basis: 50px;
    }

    .site-navbar-logo img {
        width: 47px !important;
        max-width: 47px !important;

        height: 39px !important;
        max-height: 39px !important;
    }

    .site-profile-button {
        max-width: 105px;
        min-height: 40px;
    }

    .site-profile-icon {
        display: none;
    }

    .site-profile-name {
        font-size: 11px;
    }

    .site-admin-user {
        max-width: 100px;
        min-height: 40px;
    }

    .site-admin-user-name {
        font-size: 11px;
    }

    .site-logout-button {
        min-height: 40px;
        padding: 7px 9px;
        font-size: 11px;
    }

    .site-login-button,
    .site-register-button {
        min-height: 39px;
        padding: 7px 9px;
        font-size: 11px;
    }

    .site-mobile-toggle {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }
}

/* =========================================================
   โทรศัพท์จอแคบมาก
   ========================================================= */

@media screen and (max-width: 390px) {

    .site-navbar-logo img {
        width: 42px !important;
        max-width: 42px !important;

        height: 35px !important;
        max-height: 35px !important;
    }

    .site-profile-button {
        max-width: 82px;
    }

    .site-admin-user {
        max-width: 80px;
    }

    .site-logout-button {
        padding-left: 7px;
        padding-right: 7px;
    }

    .site-register-button {
        padding-left: 7px;
        padding-right: 7px;
    }
}

/* =========================================================
   พื้นที่สำหรับ Fixed Footer
   ========================================================= */

@media screen and (max-width: 768px) {

    body {
        padding-bottom: 82px;
    }

    .site-footer {
        min-height: 72px;
        padding: 12px 10px;
    }

    .site-footer-text {
        font-size: 12px;
        line-height: 1.45;
    }
}

/* =========================================================
   FINAL MOBILE HOME FIX
   ========================================================= */

@media screen and (max-width: 768px) {

    .home-content-wrapper {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 auto !important;

        padding-top: 92px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-bottom: 90px !important;
    }

    .hero-section {
        width: 100% !important;
        max-width: 100% !important;

        margin: 0 auto !important;
        padding: 25px 15px !important;

        border-radius: 25px !important;
    }

    .hero-section h1 {
        width: 100%;

        margin-top: 0;
        margin-bottom: 20px;

        font-size: 25px !important;
        line-height: 1.35 !important;

        word-break: normal !important;
        overflow-wrap: normal !important;
    }

    .team-card {
        display: block;

        width: 100%;
        max-width: 100%;

        padding: 15px;

        word-break: normal;
    }

    .image-box {
        width: 100%;
    }

    .image-box img,
    .img-shadow {
        display: block;

        width: 100%;
        max-width: 100%;
        height: auto;
    }
}

/* =========================================================
   EXAM DROPDOWN — DESKTOP
   ========================================================= */

.site-exam-dropdown {
    position: relative;

    display: flex;
    align-items: center;

    overflow: visible;
}

.site-exam-button {
    position: relative;

    font-family: inherit;

    background: transparent;
    border: none;

    cursor: pointer;
}

/* ลูกศรข้าง Exam */

.site-exam-arrow {
    margin-left: 6px;

    font-size: 13px;
    line-height: 1;

    transition: transform 0.2s ease;
}

/* กล่องเมนูข้อสอบ */

.site-exam-menu {
    position: absolute;

    /*
       ให้กล่องซ้อนเข้าไปในปุ่ม 1px
       ป้องกันช่องว่างระหว่างปุ่มกับเมนู
    */
    top: calc(100% - 1px);
    left: 50%;
    z-index: 7000;

    width: 270px;
    padding: 12px;

    background: #ffffff;
    border: 1px solid #e4e8f3;
    border-radius: 18px;

    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.18);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    /*
       ห้ามใช้ translateY เพราะจะทำให้เกิดช่องว่างจริง
       ระหว่างปุ่มกับพื้นที่รับเมาส์
    */
    transform: translateX(-50%);

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease;
}

/* เปิดเมนูบนคอม */

.site-exam-dropdown:hover .site-exam-menu,
.site-exam-dropdown:focus-within .site-exam-menu,
.site-exam-dropdown.is-open .site-exam-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* หมุนลูกศร */

.site-exam-dropdown:hover .site-exam-arrow,
.site-exam-dropdown:focus-within .site-exam-arrow,
.site-exam-dropdown.is-open .site-exam-arrow {
    transform: rotate(180deg);
}

/* กลุ่มประเภทข้อสอบ */

.site-exam-group {
    padding: 8px;

    background: #f8f9ff;
    border-radius: 13px;
}

.site-exam-group + .site-exam-group {
    margin-top: 9px;
}

.site-exam-group-title {
    margin-bottom: 5px;
    padding: 5px 8px;

    color: #4a4e9e;
    font-size: 14px;
    font-weight: 900;
}

/* ลิงก์ข้อสอบ */

.site-exam-sub-link {
    position: relative;

    width: 100%;
    min-height: 39px;
    padding: 9px 10px;

    display: flex;
    align-items: center;

    color: #354052;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;

    border-radius: 10px;

    cursor: pointer;
    pointer-events: auto;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        padding-left 0.2s ease;
}

.site-exam-sub-link::before {
    content: "";

    width: 7px;
    height: 7px;
    margin-right: 9px;

    flex: 0 0 7px;

    background: #eb4343;
    border-radius: 50%;
}

.site-exam-sub-link:hover {
    color: #ffffff;
    background: #4a4e9e;
    padding-left: 14px;
}

/* =========================================================
   EXAM DROPDOWN — MOBILE
   ========================================================= */

@media screen and (max-width: 900px) {

    .site-exam-dropdown {
        width: 100%;

        display: block;
    }

    .site-exam-button {
        width: 100%;

        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /*
       บนมือถือให้เมนูอยู่ใน Flow ปกติ
       ไม่ลอยแบบ Desktop
    */

    .site-exam-menu {
        position: static;

        width: 100%;
        max-height: 0;

        margin: 0;
        padding: 0 8px;

        overflow: hidden;

        background: transparent;
        border: none;
        border-radius: 0;

        box-shadow: none;

        opacity: 1;
        visibility: visible;
        pointer-events: none;

        transform: none;

        transition:
            max-height 0.35s ease,
            padding-top 0.35s ease,
            padding-bottom 0.35s ease;
    }

    /*
       บนมือถือเปิดด้วย class is-open จาก navbar.js เท่านั้น
    */

    .site-exam-dropdown.is-open .site-exam-menu {
        max-height: 750px;

        padding-top: 9px;
        padding-bottom: 5px;

        pointer-events: auto;
    }

    .site-exam-dropdown.is-open .site-exam-arrow {
        transform: rotate(180deg);
    }

    .site-exam-group {
        background: #ffffff;
        border: 1px solid #e4e8f3;
    }

    .site-exam-group-title {
        font-size: 14px;
    }

    .site-exam-sub-link {
        min-height: 44px;

        font-size: 13px;
    }
}
.alert {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
}


/* =========================================================
   EXAM SIGN CONVENTION
   ========================================================= */

.exam-sign-convention {
    width: 100%;
    margin: 20px 0;
    padding: 0;

    background: #f8faff;
    border: 2px solid #cdd6ff;
    border-radius: 18px;

    box-sizing: border-box;
    overflow: hidden;
}

.exam-sign-convention summary {
    padding: 15px 18px;

    color: #33418f;
    font-size: 17px;
    font-weight: 900;

    background: #eef2ff;
    cursor: pointer;
    user-select: none;
}

.exam-sign-convention[open] summary {
    border-bottom: 1px solid #dfe5ff;
}

.sign-introduction {
    padding: 15px 18px 5px;

    color: #475569;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}

.sign-convention-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;

    padding: 15px 18px;
}

.sign-card {
    display: flex;
    align-items: center;
    gap: 14px;

    min-height: 82px;
    padding: 13px 15px;

    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;

    box-sizing: border-box;
}

.sign-card > strong {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 58px;
    min-width: 58px;
    height: 48px;

    font-size: 21px;
    font-weight: 900;

    background: #f8fafc;
    border-radius: 11px;
}

.sign-card div {
    min-width: 0;
}

.sign-card b {
    display: block;

    margin-bottom: 3px;

    color: #1e293b;
    font-size: 15px;
    font-weight: 900;
}

.sign-card span {
    display: block;

    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.sign-positive {
    border-left: 5px solid #16a34a;
}

.sign-positive > strong {
    color: #15803d;
}

.sign-negative {
    border-left: 5px solid #dc2626;
}

.sign-negative > strong {
    color: #dc2626;
}

.applied-moment-note {
    margin: 0 18px 12px;
    padding: 13px 15px;

    color: #9a3412;
    font-size: 13px;
    line-height: 1.7;

    background: #fff7ed;
    border-left: 5px solid #f97316;
    border-radius: 12px;
}

.applied-moment-note > strong {
    display: block;
    margin-bottom: 4px;
}

.applied-moment-note p {
    margin: 4px 0;
}

.absolute-value-note {
    margin: 0 18px 18px;
    padding: 12px 15px;

    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;

    background: #eff6ff;
    border-left: 5px solid #3b82f6;
    border-radius: 12px;
}

.diagram-sign-hint {
    display: block;

    margin-top: 5px;

    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

/* ปรับหมายเหตุ Fixed Moment */

.moment-sign-note {
    margin-top: 8px;
    padding: 12px 14px;

    color: #7c2d12;
    font-size: 13px;
    line-height: 1.7;

    background: #fff7ed;
    border-left: 5px solid #f97316;
    border-radius: 11px;
}

.moment-sign-note b {
    color: #c2410c;
}

.moment-sign-note span {
    color: #64748b;
    font-size: 12px;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media screen and (max-width: 700px) {
    .sign-convention-grid {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .sign-introduction {
        padding: 12px 12px 3px;
    }

    .applied-moment-note,
    .absolute-value-note {
        margin-right: 12px;
        margin-left: 12px;
    }

    .exam-sign-convention summary {
        padding: 13px 14px;
        font-size: 15px;
    }

    .sign-card {
        min-height: 75px;
    }
}

