@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;500;700&family=Noto+Sans+Thai:wght@300;400;500;700&family=Prompt:wght@300;400;600&display=swap');

/* ==========================================================================
   1. CORE STYLES (พื้นฐานหลัก)
   ========================================================================== */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    overflow-x: hidden;
    touch-action: manipulation;
    scroll-behavior: smooth; /* เลื่อนหน้าแบบนุ่มนวล */
}

:root { 
    --primary: #2c3e50; 
    --accent: #c59d5f; 
    --bg-light: #f8f9fa;
    --text: #333;
    --white: #fff; 
    --danger: #e74c3c;
    --success: #27ae60;
    --popup-bg: #ffffff;
    --popup-text: #333333;
    --popup-border: #e0e0e0;
    --text-muted: #666666;
    --news-bg: #f9f9f9;
    --card-bg: #f8f9fa;
    --card-border: #eeeeee;
    --input-bg: #f0f2f5;
    --input-border: #cccccc;
    --input-text: #333333;
}

body.dark-mode {
    --popup-bg: #252525;
    --popup-text: #ffffff;
    --popup-border: #444444;
    --text-muted: #aaaaaa;
    --news-bg: #333333;
    --card-bg: #2a2a2a;
    --card-border: #444444;
    --input-bg: #2a2a2a;
    --input-border: #444444;
    --input-text: #ffffff;
}

body { margin: 0; font-family: 'Noto Sans Thai', sans-serif; background: var(--bg-light); color: var(--text); display: flex; flex-direction: column; min-height: 100vh; }

/* Navbar */
.navbar { background: var(--white); box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; padding: 0 20px; transition: background 0.3s; }
.nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 70px; }
.logo { text-decoration: none; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; border-left: 4px solid var(--accent); padding-left: 12px; height: 50px; }
.logo-main { font-family: 'Kanit', sans-serif; font-size: 2.2rem; font-weight: 700; color: var(--primary); line-height: 1; letter-spacing: 0.5px; text-transform: uppercase; }
.logo-sub { font-family: 'Kanit', sans-serif; font-size: 0.75rem; font-weight: 500; color: var(--accent); display: block; margin-top: 2px; letter-spacing: 4px; text-transform: uppercase; }
.nav-links { display: flex; gap: 25px; align-items: center; }
.nav-links a { text-decoration: none; color: #666; font-weight: 500; transition: 0.2s; cursor: pointer; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
/* Animation ขีดวิ่ง */
.nav-links a::after { content: ''; position: absolute; width: 0; height: 2px; bottom: -5px; left: 0; background-color: var(--accent); transition: width 0.3s ease; }
.nav-links a:hover::after { width: 100%; }

.user-menu-btn { background: var(--primary); color: white !important; padding: 8px 20px; border-radius: 20px; transition: transform 0.2s; }
.user-menu-btn:hover { transform: scale(1.05); }
.hamburger { display: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }

/* Content Layout */
.user-content { max-width: 1200px; margin: 30px auto; padding: 0 20px; width: 100%; box-sizing: border-box; flex-grow: 1; padding-top: 20px; }
.page-title, .section-title, h1, h2 { margin-top: 20px !important; margin-bottom: 20px !important; clear: both; position: relative; z-index: 10; display: block; color: #2c3e50; }

/* =========================================================================
   🔥 GRID & CARDS (แก้ปัญหาสูงต่ำไม่เท่ากัน & จัดเรียง)
   ========================================================================= */
.grid { 
    display: grid; 
    /* ลดขนาดขั้นต่ำเหลือ 240px เพื่อให้เรียงได้สวยขึ้น */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); 
    gap: 25px; 
    padding: 0 5px; 
    margin-bottom: 60px !important; 
}

.card { 
    background: white; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    border: 1px solid #eee; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
    height: 100%; /* บังคับให้สูงเต็มพื้นที่ */
    display: flex; 
    flex-direction: column; 
}

.card:hover { transform: translateY(-7px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); border-color: transparent; }
.card img { width: 100%; height: 200px; object-fit: cover; background-color: #fff; border-bottom: 1px solid #f0f0f0; transition: transform 0.5s ease; }
.card:hover img { transform: scale(1.05); }

.card-body { 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; /* ยืดให้เต็มพื้นที่ */
}
/* ดันปุ่มไปล่างสุด */
.card-body .btn { margin-top: auto; }

.price { color: var(--accent); font-weight: bold; font-size: 1.2rem; margin: 10px 0; }
.btn { display: inline-block; width: 100%; padding: 12px; background: var(--accent); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; text-align: center; transition: all 0.2s; position: relative; overflow: hidden; }
.btn:hover { background: #b38e56; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(197, 157, 95, 0.3); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

/* Personnel Grid */
.personnel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; margin-top: 20px; margin-bottom: 50px; }
.personnel-card { text-align: center; padding: 25px; background: white; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: 0.3s; border-bottom: 4px solid var(--accent); }
.personnel-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.personnel-card img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin-bottom: 15px; border: 4px solid #f8f9fa; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* Slider */
.slider-container { position: relative; width: 100%; padding: 0 50px; box-sizing: border-box; margin-bottom: 40px; }
.news-track { display: flex; gap: 20px; overflow-x: auto; scroll-behavior: smooth; padding: 10px 5px; scrollbar-width: none; }
.news-track::-webkit-scrollbar { display: none; }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); background: var(--accent); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.2); display: flex; justify-content: center; align-items: center; transition: 0.2s; }
.slider-btn:hover { transform: translateY(-50%) scale(1.1); }
.prev-btn { left: 0; } .next-btn { right: 0; }

/* Admin Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; transition: 0.3s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.stat-info h3 { font-size: 0.9rem; color: #888; text-transform: uppercase; margin: 0; }
.stat-info h1 { font-size: 2.5rem; margin: 5px 0 0 0; color: #2c3e50; }
canvas { max-height: 400px; width: 100% !important; }

/* Admin Layout (Sidebar & Content) */
.admin-body { flex-direction: row; }
.sidebar { width: 260px; background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%); color: white; position: fixed; height: 100%; padding: 20px 0; display: flex; flex-direction: column; z-index: 100; transition: 0.3s; box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
.sidebar h2 { text-align: center; color: #fff; margin-bottom: 30px; font-weight: 800; letter-spacing: 2px; }
.sidebar a { padding: 15px 25px; color: #a0aab5; text-decoration: none; display: block; transition: 0.3s; cursor: pointer; margin: 5px 15px; border-radius: 8px; }
.sidebar a:hover, .sidebar a.active { background: var(--accent); color: white; transform: translateX(5px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.sidebar .logout-btn { margin-top: auto; color: #e74c3c !important; text-align: center; background: rgba(231, 76, 60, 0.1); border: 1px solid rgba(231, 76, 60, 0.2); }
.sidebar .logout-btn:hover { background: #e74c3c; color: white !important; }
.admin-content { margin-left: 260px; padding: 30px; width: 100%; transition: 0.3s; background-color: #f0f2f5; min-height: 100vh; box-sizing: border-box; }
.header-admin h1 { font-size: 1.8rem; color: #2c3e50; font-weight: 700; border-left: 6px solid var(--accent); padding-left: 15px; margin-bottom: 25px; }
.admin-menu-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 101; background: var(--accent); color: white; border: none; padding: 10px; border-radius: 5px; cursor: pointer; }

/* Admin Forms */
.admin-form-card { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); max-width: 600px; margin: 0 auto 30px auto; }
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; font-size: 1rem; transition: 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(197, 157, 95, 0.1); outline: none; }

/* Tables */
.table-container { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); overflow-x: auto; min-height: 200px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { color: #888; font-weight: 600; }
tr:hover { background-color: #f9f9f9; }

/* Popup & Loading */
.popup { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 2000; padding: 20px; backdrop-filter: blur(5px); }
.popup-content { background: white; padding: 30px; border-radius: 12px; width: 100%; max-width: 400px; position: relative; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.3); animation: popupBounce 0.4s ease; }
@keyframes popupBounce { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.popup-content input { display: block; width: 100%; padding: 12px 15px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 1rem; background-color: #f8f9fa; }
.popup-content h2 { margin-top: 0 !important; margin-bottom: 25px !important; color: var(--primary); }
.popup-content button { width: 100%; margin-top: 10px; padding: 12px; font-size: 1rem; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; transition: 0.2s; }
.close-btn:hover { transform: rotate(90deg); color: var(--accent); }
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.7); display: none; justify-content: center; align-items: center; z-index: 9999; backdrop-filter: blur(5px); transition: opacity 0.3s; }
.spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Footer */
.site-footer { background: var(--primary); color: white; padding: 40px 20px; margin-top: auto; }
.footer-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.footer-section h3 { color: var(--accent); border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 5px; margin-bottom: 15px; }
.footer-section p, .footer-section a { color: #ccc; font-size: 0.9rem; line-height: 1.6; text-decoration: none; display: block; margin-bottom: 5px; transition: 0.2s; }
.footer-section a:hover { color: white; transform: translateX(5px); }
.copyright { text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.8rem; color: #888; }

/* Misc */
.theme-btn { background: none; border: none; cursor: pointer; font-size: 1.5rem; padding: 5px; border-radius: 50%; transition: 0.3s; line-height: 1; color: var(--primary); }
.theme-btn:hover { background-color: rgba(0,0,0,0.1); }
.mobile-only { display: none; }
.desktop-only { display: block; margin-left: 15px; }

/* Profile Grid */
.profile-grid { display: grid; grid-template-columns: 350px 1fr; gap: 30px; align-items: start; }

/* Responsive */
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 70px; left: 0; width: 100%; background: var(--white); flex-direction: column; padding: 20px; box-shadow: 0 5px 10px rgba(0,0,0,0.1); box-sizing: border-box; }
    .nav-links.active { display: flex; animation: slideDown 0.3s ease; }
    @keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
    .hamburger { display: block; }
    .grid, .personnel-grid, .profile-grid { grid-template-columns: 1fr; }
    .admin-menu-toggle { display: block; }
    .sidebar { left: -260px; } .sidebar.active { left: 0; }
    .admin-content { margin-left: 0; padding-top: 60px; }
    .slider-container { padding: 0; } .slider-btn { display: none; }
    .mobile-only { display: block; } .desktop-only { display: none; }
    .card img { height: 180px; } /* ปรับความสูงรูปในมือถือ */
    .table-container .btn, table .btn { padding: 5px 10px !important; font-size: 0.9rem !important; }
}

/* Dark Mode Colors */
body.dark-mode { background-color: #121212 !important; color: #e0e0e0 !important; }
body.dark-mode .navbar { background: #1e1e1e !important; box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
body.dark-mode .logo-main, body.dark-mode .logo-sub, body.dark-mode .header-admin h1, body.dark-mode .page-title, body.dark-mode .section-title, body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 { color: #ffffff !important; }
body.dark-mode .nav-links a { color: #b0b0b0 !important; }
body.dark-mode .nav-links a:hover, body.dark-mode .nav-links a.active { color: var(--accent) !important; }
body.dark-mode .admin-content { background-color: #1a1a1a !important; }
body.dark-mode .sidebar { background: #151515 !important; }
body.dark-mode .card, body.dark-mode .admin-form-card, body.dark-mode .stat-card, body.dark-mode .personnel-card, body.dark-mode .table-container { background-color: #252525 !important; border-color: #333 !important; color: #fff !important; box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important; }
body.dark-mode .stat-info h1 { color: #fff !important; }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea, body.dark-mode .popup-content input { background-color: #333 !important; border: 1px solid #444 !important; color: #fff !important; }
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: #888 !important; }
body.dark-mode .form-group label { color: #ccc !important; }
body.dark-mode table th { color: #ccc !important; background-color: #2a2a2a !important; border-bottom: 1px solid #444 !important; }
body.dark-mode table td { color: #e0e0e0 !important; border-bottom: 1px solid #333 !important; }
body.dark-mode tr:hover { background-color: #333 !important; }
body.dark-mode .popup-content { background-color: #252525 !important; color: #fff !important; }
body.dark-mode .popup-content h2 { color: var(--accent) !important; }
body.dark-mode .site-footer { background-color: #000 !important; border-top: 1px solid #333; }
body.dark-mode .theme-btn { color: #fff; }
body.dark-mode .theme-btn:hover { background-color: rgba(255,255,255,0.2); }
body.dark-mode .nav-links { background-color: #1e1e1e; }
body.dark-mode .search-box input { background-color: #333 !important; border-color: #444 !important; color: #fff !important; }
body.dark-mode .modern-search { background-color: #252525 !important; border-color: #404040 !important; color: #fff !important; box-shadow: none; }
body.dark-mode .search-icon { color: #6b7280; }
body.dark-mode .badge-green { background: rgba(5, 150, 105, 0.2); color: #34d399; border-color: rgba(5, 150, 105, 0.4); }
body.dark-mode .badge-red { background: rgba(220, 38, 38, 0.2); color: #f87171; border-color: rgba(220, 38, 38, 0.4); }
body.dark-mode .badge-yellow { background: rgba(217, 119, 6, 0.2); color: #fbbf24; border-color: rgba(217, 119, 6, 0.4); }
body.dark-mode .badge-gray { background: rgba(75, 85, 99, 0.2); color: #d1d5db; border-color: rgba(75, 85, 99, 0.4); }


/* =========================================================================================
   ✨ ANIMATION & FIXES (ส่วนที่เพิ่มใหม่ แก้ไขปัญหา)
   ========================================================================================= */

/* 1. คลาสสำหรับทำให้เนื้อหาค่อยๆ ปรากฏ (Fade In + Slide Up) - ใช้ Animation ปลอดภัย */
.animate-fade-in {
    animation: safeFadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes safeFadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Lightbox (ดูรูปเต็ม) - แก้ไข Z-Index ให้สูงสุด */
#custom-lightbox {
    z-index: 999999 !important; /* 🔥 สำคัญ: ต้องสูงกว่า SweetAlert */
    background: rgba(0, 0, 0, 0.95) !important;
}

/* 3. Search Bar */
.search-box { width: 100% !important; max-width: 500px !important; margin: 0 auto 30px auto !important; position: relative; display: block; }
.search-box input { width: 100% !important; padding: 12px 20px 12px 45px !important; border-radius: 30px !important; border: 1px solid #ddd !important; outline: none; font-size: 1rem; box-sizing: border-box; background: var(--white); color: var(--text); transition: 0.3s; }
.search-box input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(197, 157, 95, 0.1); }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #999; font-size: 1.1rem; pointer-events: none; z-index: 10; }

/* 4. Checkout & Cart Styles */
.cart-badge { position: absolute; top: -5px; right: -8px; background-color: #e74c3c; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; min-width: 18px; text-align: center; line-height: 1.2; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 10; }
.floating-cart-btn { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background-color: var(--accent); color: white; border-radius: 50%; box-shadow: 0 4px 15px rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; font-size: 24px; cursor: pointer; z-index: 10000 !important; transition: transform 0.2s, background-color 0.2s; border: 2px solid white; }
.floating-cart-btn:hover { transform: scale(1.1); filter: brightness(1.1); }
.floating-badge { position: absolute; top: -5px; right: -5px; background-color: #e74c3c; color: white; font-size: 12px; font-weight: bold; width: 24px; height: 24px; border-radius: 50%; display: flex; justify-content: center; align-items: center; border: 2px solid white; }

.checkout-header { background: linear-gradient(135deg, #c59d5f, #e67e22); color: white; padding: 20px; border-radius: 15px 15px 0 0; text-align: center; }
.checkout-header h2 { margin: 0; font-size: 1.5rem; font-family: 'Prompt', sans-serif; }
.checkout-total { font-size: 1.8rem; font-weight: bold; margin-top: 5px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.checkout-body { padding: 25px; text-align: left; }
.bank-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 15px; display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.bank-qr { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.bank-info h3 { margin: 0; color: #c59d5f; font-size: 1rem; }
.bank-info p { margin: 2px 0; color: var(--text-muted); font-size: 0.9rem; }
.bank-acc { font-size: 1.1rem !important; font-weight: bold; color: var(--popup-text) !important; letter-spacing: 1px; }
.checkout-input-group { margin-bottom: 15px; }
.checkout-input-group label { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 5px; }
.checkout-input { width: 100%; padding: 12px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 8px; color: var(--input-text); font-size: 0.95rem; font-family: 'Prompt', sans-serif; outline: none; transition: 0.3s; }
.checkout-input:focus { border-color: #c59d5f; background: var(--popup-bg); box-shadow: 0 0 0 2px rgba(197, 157, 95, 0.2); }
.file-upload-wrapper { position: relative; width: 100%; height: 50px; border: 2px dashed var(--input-border); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; transition: 0.3s; background: var(--input-bg); }
.file-upload-wrapper:hover { border-color: #c59d5f; color: #c59d5f; }
.file-upload-wrapper input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* 5. News Popup Styles */
.news-popup-content { text-align: left; font-family: 'Prompt', sans-serif; }
.news-image-wrapper { width: 100%; height: 250px; overflow: hidden; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); position: relative; }
.news-image-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.news-image-wrapper:hover img { transform: scale(1.05); }
.news-date { display: inline-block; background: var(--accent); color: white; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; margin-bottom: 10px; font-weight: bold; }
.news-body { line-height: 1.8; color: var(--popup-text); font-size: 1rem; white-space: pre-line; background: var(--news-bg); padding: 15px; border-radius: 8px; border-left: 4px solid var(--accent); }
.swal2-close { box-shadow: none !important; outline: none !important; color: var(--text-color) !important; }
.swal2-close:hover { background: transparent !important; color: var(--accent) !important; transform: scale(1.1); }
.swal2-popup { background: var(--card-bg) !important; color: var(--text-color) !important; border: 1px solid var(--border-color); }
/* =========================================================================
   🔥 FINAL Z-INDEX FIX: จัดลำดับชั้นความสูงให้ถูกต้อง (สำคัญมาก)
   ========================================================================= */

/* 1. หน้าต่าง Login (ให้สูงกว่าเนื้อหาเว็บปกติ) */
.popup {
    z-index: 9000 !important; 
}

/* 2. SweetAlert (ข่าวสาร/แจ้งเตือน) ต้องสูงกว่า Login เพื่อให้แจ้งเตือนทับหน้า Login ได้ */
.swal2-container {
    z-index: 10000 !important; 
}

/* 3. รูปภาพเต็มจอ (Lightbox) ต้องสูงที่สุดในโลก เพื่อให้ทับทุกอย่างรวมถึงข่าวสาร */
#custom-lightbox {
    z-index: 2147483647 !important; /* ค่าสูงสุดที่ Browser รองรับ */
}

/* ตัวหมุนๆ เวลาโหลด */
.loading-overlay {
    z-index: 20000 !important;
}