@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');

/* ================= RESET (ลบขอบขาว/ล็อกจอ) ================= */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    overflow-x: hidden; /* ห้ามเลื่อนซ้ายขวา */
    touch-action: manipulation; /* ช่วยให้กดปุ่มไวขึ้นในมือถือ */
}

:root { 
    --primary: #2c3e50; 
    --accent: #c59d5f; 
    --bg-light: #f8f9fa;
    --text: #333;
    --white: #fff; 
    --danger: #e74c3c;
    --success: #27ae60;
    
    /* ตัวแปรสำหรับ Popup (Theme System) */
    --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;
}

/* ================= DARK MODE VARIABLES ================= */
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; }

/* ==============================
   1. NAVIGATION (TOP BAR)
   ============================== */
.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;
}

.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);        
    background: transparent;     
    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;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

.user-menu-btn {
    background: var(--primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: 20px;
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* ==============================
   2. MAIN LAYOUT & USER CONTENT
   ============================== */
.user-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    flex-grow: 1;
    padding-top: 20px; 
}

/* Page Titles */
.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;
}

/* ==============================
   3. ADMIN SIDEBAR & LAYOUT
   ============================== */
.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;
}

/* ==============================
   4. CARDS, GRIDS & PRODUCT
   ============================== */
/* General Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 0 10px;
    margin-bottom: 60px !important;
}

/* Card Style */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    transition: transform 0.3s ease; 
    height: 100%; 
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card img {
    width: 100%;
    height: 200px;            
    object-fit: cover;        
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
}

.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: 6px; cursor: pointer; font-weight: 600; text-align: center; transition: 0.3s; }
.btn:hover { background: #b38e56; }
.btn:disabled { background: #ccc; cursor: not-allowed; }

/* ==============================
   5. PERSONNEL GRID (แก้ไขแล้ว)
   ============================== */
.personnel-grid {
    display: grid;
    /* ใช้ auto-fill เพื่อไม่ให้การ์ดยืดเต็มจอถ้ารายการน้อย */
    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); }

.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);
}

/* ==============================
   6. NEWS 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;
}
.prev-btn { left: 0; }
.next-btn { right: 0; }

/* ==============================
   7. ADMIN DASHBOARD & FORMS (แก้ไขแล้ว)
   ============================== */
/* Dashboard Grid */
.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;
}
.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 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;
}

/* Tables */
.table-container {
    background: #fff; border-radius: 10px; padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); overflow-x: auto;
}
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; }

/* ==============================
   8. MISC (Search, Profile, Popups)
   ============================== */
.search-box {
    width: 100%; max-width: 500px; margin: 0 auto 30px auto; position: relative;
}
.search-box input {
    width: 100%; padding: 12px 20px 12px 45px; border-radius: 30px; border: 1px solid #ddd; outline: none;
}
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #999; }

.profile-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

.popup { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.popup-content { background: white; padding: 30px; border-radius: 12px; width: 100%; max-width: 400px; position: relative; text-align: center; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; }

.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8);
    display: none; justify-content: center; align-items: center; z-index: 9999;
}
.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); } }

/* Status Badges */
.status-badge { padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; }
.bg-wait { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.bg-done { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.bg-cancel { background: #fff1f0; color: #f5222d; border: 1px solid #ffa39e; }

/* ==============================
   9. RESPONSIVE (Mobile)
   ============================== */
@media (max-width: 768px) {
    .nav-links {
        position: absolute; top: 70px; left: 0; width: 100%; background: white;
        flex-direction: column; padding: 20px; box-shadow: 0 5px 10px rgba(0,0,0,0.1); display: none;
    }
    .nav-links.active { display: flex; }
    .hamburger { display: block; }
    
    .grid, .personnel-grid { grid-template-columns: 1fr; } /* มือถือ 1 คอลัมน์ */
    .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; } /* ซ่อนปุ่มเลื่อนในมือถือ ให้ใช้นิ้วปัดเอา */
}
/* ==============================
   10. POPUP FORM FIX (แก้ Popup เพี้ยน)
   ============================== */
.popup-content input {
    display: block;          /* บังคับให้ขึ้นบรรทัดใหม่ ไม่วางต่อกัน */
    width: 100%;             /* ความกว้างเต็ม 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 input:focus {
    border-color: var(--accent); /* เวลากดพิมพ์ให้เป็นสีทอง */
    background-color: #fff;
    outline: none;
}

.popup-content h2 {
    text-align: center;      /* จัดหัวข้อให้อยู่ตรงกลาง */
    margin-top: 0 !important;
    margin-bottom: 25px !important;
    color: var(--primary);
}

.popup-content button {
    width: 100%;             /* ปุ่มกว้างเต็ม */
    margin-top: 10px;
    padding: 12px;
    font-size: 1rem;
}
/* ==============================
   11. SWEETALERT Z-INDEX FIX
   (แก้ปัญหาแจ้งเตือนไปซ่อนอยู่หลัง Popup)
   ============================== */
.swal2-container {
    z-index: 10000 !important; /* ตั้งให้สูงกว่า .popup (ซึ่งปกติคือ 2000) */
}
/* ==============================
   12. FOOTER
   ============================== */
.site-footer {
    background: var(--primary);
    color: white;
    padding: 40px 20px;
    margin-top: auto; /* ดัน Footer ไปล่างสุดเสมอ */
}
.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; }
.footer-section a:hover { color: white; }
.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; }

/* ================= THEME BUTTON STYLE ================= */
.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); }

body.dark-mode .theme-btn { color: #fff; } /* โหมดมืดให้ปุ่มสีขาว */

body.dark-mode .theme-btn:hover { background-color: rgba(255,255,255,0.2); }

/* ================= RESPONSIVE (จัดการแสดงผลมือถือ/คอม) ================= */
/* ค่าเริ่มต้น (Desktop): ซ่อนปุ่มมือถือ, ซ่อน hamburger */
.mobile-only { display: none; }
.desktop-only { display: block; margin-left: 15px; }
.hamburger { display: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }

/* มือถือ (จอเล็กกว่า 768px) */
@media (max-width: 768px) {
    /* ซ่อนเมนูยาวๆ */
    .nav-links {
        position: absolute; top: 70px; left: 0; width: 100%; background: white;
        flex-direction: column; padding: 20px; box-shadow: 0 5px 10px rgba(0,0,0,0.1); display: none;
        box-sizing: border-box; /* กันขอบล้น */
    }
    .nav-links.active { display: flex; } /* โชว์เมื่อกดเปิด */

    /* โชว์ปุ่มมือถือ และ Hamburger */
    .mobile-only { display: block; }
    .hamburger { display: block; }
    
    /* ซ่อนปุ่มของ Desktop */
    .desktop-only { display: none; }
    
    /* ปรับแต่ง Dark Mode ในเมนูมือถือ */
    body.dark-mode .nav-links { background-color: #1e1e1e; }
} 

/* =======================================================
   13. DARK MODE COLORS (ชุดโค้ดเปลี่ยนสี)
   ======================================================= */
body.dark-mode {
    background-color: #121212 !important; /* สีพื้นหลังดำ */
    color: #e0e0e0 !important; /* ตัวหนังสือขาวนวล */
}

/* Navbar & Top Bar */
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;
}

/* พื้นหลังส่วน Admin */
body.dark-mode .admin-content {
    background-color: #1a1a1a !important;
}

/* Sidebar (ทำให้เข้มขึ้น) */
body.dark-mode .sidebar {
    background: #151515 !important;
}

/* Cards (กล่องต่างๆ) */
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;
}

/* Stat Card Text */
body.dark-mode .stat-info h1 {
    color: #fff !important;
}

/* Inputs & Forms (สำคัญมาก! เปลี่ยนสีช่องกรอก) */
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;
}

/* Tables */
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;
}

/* Popups */
body.dark-mode .popup-content {
    background-color: #252525 !important;
    color: #fff !important;
}
body.dark-mode .popup-content h2 {
    color: var(--accent) !important;
}

/* Footer */
body.dark-mode .site-footer {
    background-color: #000 !important;
    border-top: 1px solid #333;
}

/* ================= CSS FIX (แก้ระยะห่าง) ================= */
/* 1. ลดช่องว่างด้านบนของหัวข้อ */
.page-title, .section-title, h1, h2 {
    margin-top: 20px !important;
}

/* 2. ดัน Footer ให้ติดล่างสุดแบบสวยๆ */
.user-content {
    flex-grow: 1;
    min-height: 60vh;
}

/* 3. ปรับตารางในหน้า Profile ให้ดูเต็มขึ้น */
.table-container {
    min-height: 200px;
}

/* 4. ปรับ Popup เลือกหมวดหมู่ให้สวยขึ้น */
.swal2-popup .cat-chk {
    accent-color: var(--accent);
    transform: scale(1.2);
}

/* ================= Cart Badge (วงกลมแจ้งเตือนตะกร้า) ================= */
a[href="cart.html"] {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.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 (ปุ่มตะกร้าลอย) ================= */
.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: 9999;
    transition: transform 0.2s, background-color 0.2s;
}

.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;
}

/* =========================================================
   UNIVERSAL POPUP THEME (แก้ปัญหา Popup ไม่เปลี่ยนสี)
   (แก้ไขล่าสุด: รวม News Popup และ Checkout Popup ให้เปลี่ยนตามธีม)
   ========================================================= */

/* บังคับให้ SweetAlert ใช้ตัวแปรสีของเรา */
div:where(.swal2-container) div:where(.swal2-popup) {
    background-color: var(--popup-bg) !important;
    color: var(--popup-text) !important;
    border: 1px solid var(--popup-border);
    border-radius: 16px;
}

/* แก้สีหัวข้อ */
div:where(.swal2-container) .swal2-title {
    color: var(--popup-text) !important;
    font-family: 'Prompt', sans-serif;
}

/* แก้สีเนื้อหา */
div:where(.swal2-container) .swal2-html-container {
    color: var(--popup-text) !important;
}

/* ปุ่มปิด (X) */
div:where(.swal2-container) .swal2-close {
    color: var(--popup-text) !important;
}
div:where(.swal2-container) .swal2-close:hover {
    color: var(--accent) !important;
}

/* ================== Modern Checkout Popup ================== */
.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); }
.checkout-input::placeholder { color: #888; }

.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;
}

/* ================== News Popup Design (ดีไซน์ข่าวสารใหม่) ================== */
.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);
}
/* ลบกรอบปุ่มปิด Popup */
.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);
}
/* ปรับพื้นหลัง Popup ให้ดูดีขึ้นในโหมดมืด */
.swal2-popup {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
}
