﻿
/* ==========================================
   1. VARIABLES & BASE STYLES
============================================ */
:root {
    --primary-color: #e65100; /* ส้มหลัก มสธ. Modern */
    --primary-light: #ff7043; /* สีส้มตอน Hover */
    --accent-color: #ffb300; /* ส้มอมเหลืองทองตัดขอบ */
    --card-bg: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 15px rgba(230, 81, 0, 0.04);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'IBM Plex Sans Thai', 'Prompt', sans-serif;
}

body {
    background: #fdfbf7;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 920px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ==========================================
   2. HEADER & CORE LAYOUT
============================================ */
.main-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(230, 81, 0, 0.1);
}

.logo-zone {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    font-size: 2.2rem;
    color: var(--primary-color);
}

.main-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
}

.main-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Base Card Styles */
.search-card, .result-container-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid #edf2f7;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ==========================================
   3. FORM & BUTTONS COMPONENTS
============================================ */
.search-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

    .form-group label {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-main);
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }

        .form-group label i {
            color: var(--primary-color);
        }

    .form-group input[type="text"],
    .form-group input[type="password"] {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border: 1.5px solid var(--border-color);
        border-radius: 8px;
        outline: none;
        background-color: #f8fafc;
        transition: all 0.2s ease;
        box-sizing: border-box;
    }

        .form-group input[type="text"]:focus,
        .form-group input[type="password"]:focus {
            border-color: var(--primary-color);
            background-color: #fff;
            box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
        }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

    .btn-primary:hover {
        background-color: var(--primary-light) !important;
    }

.btn-secondary {
    background-color: #edf2f7 !important;
    color: var(--text-main) !important;
}

    .btn-secondary:hover {
        background-color: #e2e8f0 !important;
    }

/* ==========================================
   4. STUDENT PROFILE LAYOUT
============================================ */
.result-header-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #edf2f7;
}

.student-info-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1.25rem;
}

.info-row {
    display: flex;
    font-size: 1rem;
    align-items: center;
}

.info-label {
    width: 140px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

    .info-label i {
        color: var(--primary-color);
    }

.info-value {
    color: var(--text-main);
    font-weight: 600;
}

/* ==========================================
   5. GRIDVIEW SYSTEM (หน้าหลักค้นหาผลสอบ)
============================================ */
.modern-grid {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0 14px;
}

    .modern-grid th {
        display: none;
    }

    .modern-grid td {
        padding: 0;
        background: transparent !important;
    }

/* บล็อกการ์ดตารางสอบ 3 คอลัมน์ */
.exam-item-card {
    background: #ffffff;
    border: 1px solid #edf2f7;
    border-left: 6px solid var(--primary-color);
    border-radius: 10px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1.8fr 0.5fr;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.01);
}

.subject-info h4 {
    color: var(--primary-color);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subject-info p {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
}

.schedule-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 1px solid #edf2f7;
    padding-left: 1.5rem;
}

.schedule-row {
    display: flex;
    align-items: center;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
}

.schedule-text {
    display: inline-block;
    line-height: 1.2;
}

.schedule-info i.fa-calendar, .schedule-info i.fa-clock {
    color: #f6ad55;
    font-size: 0.95rem;
    width: 20px;
    flex-shrink: 0;
}

/* Microsoft Teams Design */
.room-text i.fa-microsoft {
    color: #4654a4 !important;
    font-size: 0.95rem;
    width: 20px;
    flex-shrink: 0;
}

.room-text strong {
    color: var(--text-main);
}

.room-highlight {
    color: #4654a4;
    font-weight: 700;
    background-color: #f0f2fa;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    display: inline-block;
}

.status-info {
    display: flex;
    justify-content: flex-end;
}

/* Badges UI */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

    .status-badge.success {
        background: #def7ec;
        color: #03543f;
    }

    .status-badge.warning {
        background: #fff3cd;
        color: #856404;
        border: 1px solid #ffeeba;
    }

/* Empty state layout */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.empty-icon {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

/* ==========================================
   6. PRINT REPORT SYSTEM (ExportPDF.aspx)
============================================ */
/* ปุ่มออกรายงาน PDF หน้าหลัก */
.btn-pdf {
    background-color: transparent !important;
    color: var(--primary-color) !important;
    border: 1.5px solid var(--primary-color) !important;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .btn-pdf:hover {
        background-color: var(--primary-color) !important;
        color: #ffffff !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(230, 81, 0, 0.15);
    }

    .btn-pdf i {
        font-size: 1.05rem;
    }

/* โครงสร้างตารางและช่องไฟหน้ารายงานสรุป */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
}

    .report-table th {
        background: #edf2f7;
        color: #4a5568;
        font-weight: 600;
        padding: 0.6rem 1rem;
        border-bottom: 2px solid #cbd5e0;
        font-size: 0.9rem;
        text-align: left;
        vertical-align: middle;
        line-height: 1.2;
    }

    .report-table td {
        padding: 1.1rem 1rem !important;
        border-bottom: 1px solid #edf2f7;
        font-size: 0.9rem;
        vertical-align: middle !important;
        line-height: 1.4;
        color: #2d3748;
    }

        .report-table td:nth-child(2) {
            white-space: normal !important;
            word-wrap: break-word;
            max-width: 0;
        }

    .report-table tr:nth-child(even) {
        background: #fbfcfd;
    }

/* บล็อกแสดงตารางวันเวลาสอบ */
.pdf-schedule-block {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

.pdf-schedule-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

/* ป้ายกำกับข้อความ */
.label-badge {
    background-color: #fff3eb;
    color: #e65100;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    width: 105px;
    text-align: center;
    display: inline-block;
    flex-shrink: 0;
}

.label-badge-sub {
    background-color: #fef8e7;
    color: #b7791f;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    width: 105px;
    text-align: center;
    display: inline-block;
    flex-shrink: 0;
}

/* ตัวหนังสือข้อความวันที่ */
.date-value {
    font-size: 0.88rem;
    color: #2d3748;
    font-weight: 500;
    white-space: normal;
    line-height: 1.3;
}

/* บล็อกช่องทางสอบ/เบอร์ห้องสีฟ้า */
.report-table .room-highlight {
    color: #4654a4;
    font-weight: 700;
    background-color: #f0f2fa;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-block;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ป้ายตกแต่งกล่องลำดับที่นั่งหน้ารายงาน PDF */
.rank-badge-pdf {
    display: inline-block;
    background-color: #fffde7;
    color: #856404;
    border: 1px solid #fff3cd;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================
   7. FOOTER SYSTEM
============================================ */
.main-footer {
    width: 100%;
    margin-top: 4rem;
    padding: 2rem 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.footer-content {
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

    .footer-content p {
        font-size: 0.88rem;
        font-weight: 500;
        color: var(--text-main);
        text-align: center !important;
    }

    .footer-content i {
        color: var(--primary-color);
        margin-right: 0.3rem;
    }

.footer-copyright {
    font-size: 0.75rem !important;
    color: var(--text-muted);
    font-weight: 400 !important;
    text-align: center !important;
}

/* ==========================================
   8. MEDIA PRINT CONTROL (ขาวดำทางการ)
============================================ */
@media print {
    body {
        background: #ffffff !important;
        padding: 0;
    }

    .print-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .toolbar {
        display: none !important;
    }

    .pdf-schedule-row i, .print-header i {
        display: none !important;
    }

    .label-badge, .label-badge-sub {
        background: transparent !important;
        color: #000000 !important;
        padding: 0 !important;
        width: 70px !important;
        font-weight: 600 !important;
    }

    .date-value {
        color: #000000 !important;
    }

    .room-highlight, .report-table .room-highlight, .rank-badge-pdf {
        background: transparent !important;
        color: #000000 !important;
        border: none !important;
        padding: 0 !important;
        font-weight: 600 !important;
    }

    .report-table th {
        background: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }

    .report-table td {
        border-bottom: 1px solid #cbd5e1 !important;
        color: #000000 !important;
    }
}

/* ==========================================
   🏛️ RE-DESIGN PRINT HEADER & META LAYOUT
============================================ */
.toolbar {
    max-width: 1040px;
    margin: 1.5rem auto 1rem auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.btn-action {
    padding: 0.55rem 1.2rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back {
    color: #4a5568 !important;
    background-color: #f7fafc !important;
    border: 1px solid #e2e8f0 !important;
}

    .btn-back:hover {
        background-color: #edf2f7 !important;
    }

.btn-print {
    color: #ffffff !important;
    background-color: #e65100 !important;
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(230, 81, 0, 0.1);
}

    .btn-print:hover {
        background-color: #bf4300 !important;
    }

.print-container {
    max-width: 1040px;
    margin: 1.5rem auto 3rem auto;
    background: #ffffff;
    padding: 2.5rem 3rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #e65100;
    padding-bottom: 1.5rem;
    margin-bottom: 1.75rem;
    width: 100%;
}

.header-text-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.print-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    line-height: 1.3;
}

.university-subtext {
    margin: 0 !important;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
    line-height: 1.4;
}

.stou-logo {
    width: 70px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    margin-left: 1.5rem;
}

.student-meta {
    background-color: #f8fafc;
    border-left: 4px solid #ffb300;
    padding: 1.25rem 1.75rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 2.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    align-items: center;
}

.meta-item {
    font-size: 0.95rem;
    color: #2d3748;
    line-height: 1.5;
    white-space: nowrap;
}

    .meta-item strong {
        color: #4a5568;
        font-weight: 600;
        margin-right: 0.35rem;
    }

/* ==========================================
   🔒 9. ADMIN LOGIN SYSTEM
============================================ */
.login-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: calc(100vh - 240px) !important;
    padding: 4rem 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.login-box-card {
    background: #ffffff !important;
    border-radius: var(--radius, 12px);
    padding: 2.5rem 2.25rem !important;
    box-shadow: 0 10px 25px -5px rgba(0, 77, 64, 0.05) !important;
    border: 1px solid #edf2f7;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-sizing: border-box;
}

    .login-box-card::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 4px !important;
        background: linear-gradient(90deg, #004d40, #ffb300, #e65100) !important;
        border-radius: 12px 12px 0 0 !important;
    }

.login-title-zone {
    text-align: center !important;
    margin-bottom: 2rem !important;
}

    .login-title-zone h2 {
        font-size: 1.35rem !important;
        font-weight: 700 !important;
        color: var(--primary-color, #e65100);
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }

    .login-title-zone p {
        font-size: 0.88rem !important;
        color: var(--text-muted, #718096);
        margin-top: 0.45rem;
        font-weight: 500;
    }

.login-box-card .form-group {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

    .login-box-card .form-group label i {
        color: #004d40 !important;
    }

.login-btn-wide {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    background-color: #004d40 !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 77, 64, 0.1);
    transition: all 0.2s;
}

    .login-btn-wide:hover {
        background-color: #00332c !important;
        transform: translateY(-1px);
        box-shadow: 0 6px 12px -1px rgba(0, 77, 64, 0.2) !important;
    }

/* ==========================================
   🔒 11. ADMIN DASHBOARD CONTROL
============================================ */
.admin-container {
    width: 100%;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: 'IBM Plex Sans Thai', sans-serif;
}

.admin-main-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(230, 81, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-title-zone {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .admin-title-zone i {
        font-size: 2rem;
        color: #e65100;
    }

.admin-main-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e65100;
    margin: 0;
}

.admin-main-header p {
    font-size: 0.85rem;
    color: #718096;
    margin: 0.25rem 0 0 0;
}

.admin-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(230, 81, 0, 0.02);
    border: 1px solid #edf2f7;
    margin-bottom: 1.5rem;
}

.admin-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-inline-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap; /* ⚡ [MOBILE-RESPONSIVE] เปิดให้ตัดบรรทัดปุ่มบนจอมือถือได้ไม่ล้นเฟรม */
}

.form-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

    .form-block label {
        font-size: 0.95rem;
        font-weight: 600;
        color: #2d3748;
    }

        .form-block label i {
            color: #e65100;
            margin-right: 0.3rem;
        }

    .form-block input[type="text"] {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 1rem;
        border: 1.5px solid #e2e8f0;
        border-radius: 8px;
        outline: none;
        background-color: #f8fafc;
        transition: all 0.2s;
        box-sizing: border-box;
    }

        .form-block input[type="text"]:focus {
            border-color: #e65100;
            background-color: #fff;
            box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
        }

.btn-admin-panel {
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-orange {
    background-color: #e65100 !important;
    color: white !important;
}

    .btn-orange:hover {
        background-color: #bf4300 !important;
    }

.btn-slate {
    background-color: #475569 !important;
    color: white !important;
}

    .btn-slate:hover {
        background-color: #334155 !important;
    }

.admin-mini-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    text-align: left;
}

    .admin-mini-table th {
        background-color: #f8fafc;
        color: #475569;
        font-weight: 600;
        padding: 0.85rem 1rem;
        border-bottom: 2px solid #e2e8f0;
        font-size: 0.9rem;
    }

    .admin-mini-table td {
        padding: 1rem;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.9rem;
        color: #334155;
        vertical-align: middle;
    }

    .admin-mini-table tr:hover {
        background-color: #f8fafc;
    }

.btn-action-mini {
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
}

.btn-mini-edit {
    background-color: #fef3c7;
    color: #d97706;
    margin-right: 0.3rem;
}

    .btn-mini-edit:hover {
        background-color: #fde68a;
    }

.btn-mini-delete {
    background-color: #fee2e2;
    color: #dc2626;
}

    .btn-mini-delete:hover {
        background-color: #fecaca;
    }

.table-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-user-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.admin-badge-name {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background-color: #f0f4f1;
    color: #004d40;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #cbd5e1;
}

    .admin-badge-name i {
        font-size: 1.05rem;
        color: #e65100;
    }

/* ==========================================
   🏛️ 12. MASTER PAGE NAVIGATION & AUTH UI
============================================ */
.master-top-bar {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    box-sizing: border-box;
}

.master-nav-container {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.btn-staff-gate {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569 !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

    .btn-staff-gate:hover {
        color: #e65100 !important;
        border-color: #e65100;
        background-color: #fff3eb;
        transform: translateY(-1px);
    }

.master-admin-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.master-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #e6f4ea;
    color: #03543f;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}

    .master-admin-badge i {
        color: #e65100;
    }

.btn-master-logout {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff !important;
    background-color: #475569;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
}

    .btn-master-logout:hover {
        background-color: #334155;
        transform: translateY(-1px);
    }

/* ==========================================
   🔒 13. MODAL POP-UP FORM DIALOG (ทำจบในหน้าเดียว)
============================================ */
.modal-backdrop-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(15, 23, 42, 0.6) !important;
    z-index: 9999 !important;
    overflow-y: auto !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
}

    .modal-backdrop-overlay .form-container {
        width: 100%;
        max-width: 720px;
        margin: 4vh auto !important;
        font-family: 'IBM Plex Sans Thai', 'Prompt', sans-serif;
    }

    .modal-backdrop-overlay .form-card {
        background: #ffffff !important;
        border-radius: 12px !important;
        padding: 2.5rem !important;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
        border: 1px solid #edf2f7 !important;
    }

    .modal-backdrop-overlay .form-header {
        border-bottom: 2px solid rgba(230, 81, 0, 0.1);
        padding-bottom: 1rem;
        margin-bottom: 2rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

        .modal-backdrop-overlay .form-header i {
            font-size: 1.6rem;
            color: #e65100;
        }

        .modal-backdrop-overlay .form-header h2 {
            font-size: 1.35rem;
            font-weight: 700;
            color: #e65100;
            margin: 0;
        }

    .modal-backdrop-overlay .input-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }

    .modal-backdrop-overlay .field-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

        .modal-backdrop-overlay .field-group label {
            font-size: 0.9rem;
            font-weight: 600;
            color: #2d3748;
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }

            .modal-backdrop-overlay .field-group label i {
                color: #e65100;
                font-size: 0.95rem;
            }

        .modal-backdrop-overlay .field-group input[type="text"] {
            width: 100% !important;
            padding: 0.7rem 0.95rem !important;
            font-size: 0.95rem !important;
            border: 1.5px solid #e2e8f0 !important;
            border-radius: 6px !important;
            outline: none !important;
            background-color: #f8fafc !important;
            transition: all 0.2s !important;
            box-sizing: border-box !important;
        }

            .modal-backdrop-overlay .field-group input[type="text"]:focus {
                border-color: #e65100 !important;
                background-color: #ffffff !important;
                box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.08) !important;
            }

        .modal-backdrop-overlay .field-group input[readonly] {
            background-color: #edf2f7 !important;
            color: #718096 !important;
            cursor: not-allowed !important;
            border-color: #cbd5e0 !important;
        }

    .modal-backdrop-overlay .form-actions-zone {
        margin-top: 2.5rem;
        padding-top: 1.25rem;
        border-top: 1px solid #edf2f7;
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
    }

    .modal-backdrop-overlay .btn-form {
        padding: 0.6rem 1.6rem !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        border: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.4rem;
        transition: all 0.2s !important;
    }

    .modal-backdrop-overlay .btn-save {
        background-color: #e65100 !important;
        color: white !important;
    }

        .modal-backdrop-overlay .btn-save:hover {
            background-color: #bf4300 !important;
        }

    .modal-backdrop-overlay .btn-cancel {
        background-color: #edf2f7 !important;
        color: #4a5568 !important;
    }

        .modal-backdrop-overlay .btn-cancel:hover {
            background-color: #e2e8f0 !important;
        }

/* ==========================================
     📱 14. MOBILE RESPONSIVE MEDIA QUERIES
============================================ */
@media (max-width: 768px) {
    /* ⚡ ปรับกรอบแสดงผลตารางการ์ดสอบ (Repeater) ฝั่งแอดมินให้หรี่ตัวยุบรวมเป็นคอลัมน์เดียวแนวตั้ง */
    .exam-item-card {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
        padding: 1.25rem;
    }

    .schedule-info {
        border-left: none !important;
        border-top: 1px solid #edf2f7;
        padding-left: 0 !important;
        padding-top: 1.25rem;
    }

    .status-info {
        justify-content: flex-start !important;
        margin-top: 0.5rem;
    }

    /* จัดปุ่มในกล่องควบคุมสืบค้นหลักให้ยุบตัวสลวยบนแท็บเล็ตและมือถือ */
    .search-inline-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .btn-admin-panel {
        width: 100% !important;
        justify-content: center;
    }

    .table-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    /* ⚡ ยุบโครงสร้างกริดอินพุตฟอร์มจาก 2 เหลือ 1 คอลัมน์บนสมาร์ทโฟนแคบ */
    .modal-backdrop-overlay .input-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .modal-backdrop-overlay {
        padding: 0.75rem 0.5rem !important;
    }

        .modal-backdrop-overlay .form-card {
            padding: 1.5rem 1.25rem !important;
        }

        .modal-backdrop-overlay .form-actions-zone {
            flex-direction: column;
            gap: 0.5rem;
        }

        .modal-backdrop-overlay .btn-form {
            width: 100% !important;
        }

    .admin-main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
