/* public/css/admin-luxury.css - LIGHT LUXURY EDITION (FULL VERSION) */

/* 1. Import ฟอนต์ */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800&display=swap');

/* ✅ 1. ใส่โค้ดนี้ไว้บนสุดของไฟล์ เพื่อแก้ปัญหากล่องเบี้ยว/ยาวไม่เท่ากัน */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ✅ 2. แก้ปัญหา Chrome ใส่สีพื้นหลังสีขาวให้อัตโนมัติ (Autofill) ให้กลับมาเป็นสีสว่าง */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important; /* เปลี่ยนเป็นขาว */
    -webkit-text-fill-color: #0f172a !important;            /* ตัวหนังสือดำ */
    transition: background-color 5000s ease-in-out 0s;
}

/* 2. ตั้งค่าตัวแปรสี (Theme Variables - Light Version) */
:root {
    --bg-dark: #f1f5f9;         /* พื้นหลังหลัก (เปลี่ยนจาก Navy เป็น Light Gray) */
    --bg-card: #ffffff;         /* พื้นหลังกล่อง (White) */
    --bg-sidebar: #ffffff;      /* พื้นหลังเมนูข้าง (White) */
    --text-main: #0f172a;       /* สีตัวอักษรหลัก (Dark Navy) */
    --text-muted: #64748b;      /* สีตัวอักษรรอง (Slate) */
    --accent-gold: #d97706;     /* สีทอง (ปรับให้เข้มขึ้นเพื่อให้ชัดบนพื้นขาว) */
    --accent-blue: #2563eb;     /* สีน้ำเงินโปร */
    --accent-green: #10b981;    /* สีเขียวสำเร็จ */
    --accent-red: #ef4444;      /* สีแดงแจ้งเตือน */
    --border-color: #e2e8f0;    /* เส้นขอบสีเทาอ่อน */
}

/* 3. Global Styles */
body {
    margin: 0;
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-size: 14px;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }

/* 4. Layout Structure */
.wrap {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   5. SIDEBAR STYLES (ส่วนเมนูซ้ายดีไซน์ใหม่ - โทนสว่าง)
   ========================================= */
.side {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.02);
}

.side h3 {
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 25px 0;
    font-size: 1.2rem;
}

/* หัวข้อหมวดหมู่ */
.side .sec {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 25px;
    margin-bottom: 10px;
    font-weight: 700;
}

/* ลิงก์เมนู */
.side a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #475569;
    border-radius: 8px;
    font-weight: 500;
    margin-bottom: 5px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* Effect ตอนเอาเมาส์ชี้ */
.side a:hover {
    background: #eff6ff; /* ฟ้าอ่อนมาก */
    color: var(--accent-blue);
    transform: translateX(5px);
    border-color: rgba(37, 99, 235, 0.1);
}

/* ไอคอน SVG */
.menu-icon {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: 0.2s;
}

.side a:hover .menu-icon {
    opacity: 1;
    color: var(--accent-blue);
    filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.3));
}

.side hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.side .small {
    font-size: 0.8em;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

/* ปุ่ม Logout แบบใหม่ */
.btn-logout {
    width: 100%;
    margin-top: 20px;
    background: #fef2f2; /* แดงอ่อนมาก */
    border: 1px solid #fee2e2;
    color: #ef4444;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ef4444;
    color: #fff;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* =========================================
   6. MAIN CONTENT STYLES
   ========================================= */
.main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--text-main);
    font-weight: 800;
}

/* --- Components --- */
.card-container {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Badge (ป้ายสถานะ/ตัวเลข) */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 18px;
    text-align: center;
}
.badge-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-pending { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.badge-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Alerts */
.ok { 
    background: #ecfdf5; 
    color: #065f46; 
    padding: 15px; 
    border-radius: 8px; 
    border: 1px solid #a7f3d0; 
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    font-weight: 500;
}
.err { 
    background: #fef2f2; 
    color: #991b1b; 
    padding: 15px; 
    border-radius: 8px; 
    border: 1px solid #fecaca;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    font-weight: 500;
}

/* Form Elements */
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-main) !important;
    padding: 10px 15px;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
}
input:focus, select:focus { 
    border-color: var(--accent-blue) !important; 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

/* Table styling (เก็บไว้ใช้หน้าอื่น) */
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th { 
    text-align: left; 
    padding: 15px; 
    color: var(--text-muted); 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.85em; 
    border-bottom: 2px solid var(--border-color);
    background-color: #f8fafc;
}
td { 
    padding: 15px; 
    border-bottom: 1px solid #f1f5f9; 
    color: var(--text-sub); 
}
tr:hover td { background-color: #f8fafc; }

/* ======================================================
   FORCE GREEN BUTTONS (สั่งบังคับปุ่มยืนยันเป็นสีเขียว)
   ====================================================== */

/* 1. ดักจับปุ่ม Submit ทุกตัวในเว็บ ให้เป็นสีเขียวทันที */
button[type="submit"],
input[type="submit"] {
    background: linear-gradient(135deg, #10b981, #059669) !important; /* เขียว Luxury */
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3) !important;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* 2. เอฟเฟกต์ตอนเอาเมาส์ชี้ */
button[type="submit"]:hover,
input[type="submit"]:hover {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4) !important;
    transform: translateY(-2px);
}

/* 3. (เผื่อไว้) ถ้าปุ่มนั้นใช้แท็ก <a> แต่อยากให้เขียวด้วย */
a.btn-confirm {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
}

/* ======================================================
   FIX LOGOUT BUTTON (แก้ปุ่ม Logout ให้กลับเป็นสีแดง)
   ====================================================== */
button.btn-logout {
    background: #fef2f2 !important; /* พื้นหลังแดงจาง */
    border: 1px solid #fee2e2 !important; /* ขอบแดง */
    color: #ef4444 !important; /* ตัวหนังสือแดงเข้ม */
    box-shadow: none !important; 
    margin-top: 20px !important;
}

button.btn-logout:hover {
    background: #ef4444 !important; /* แดงเข้มตอนชี้ */
    color: #ffffff !important;
    border-color: #dc2626 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
    transform: translateY(-2px) !important;
}

/* ======================================================
   🔴🟠 MAGIC BUTTON FIX (วางต่อท้ายไฟล์เดิมได้เลย)
   ====================================================== */

/* 1. แก้ปุ่มลบ (สีแดง) ให้ชนะสีเขียว */
button[style*="#ef4444"], 
button[style*="rgb(239, 68, 68)"],
.btn-red {
    background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 8px;
}

button[style*="#ef4444"]:hover,
button[style*="rgb(239, 68, 68)"]:hover,
.btn-red:hover {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4) !important;
    transform: translateY(-2px);
}

/* 2. แก้ปุ่มรีเซ็ต (สีส้ม) ให้ชนะสีเขียว */
button[style*="#f97316"],
button[style*="rgb(249, 115, 22)"],
.btn-orange {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 8px;
}

button[style*="#f97316"]:hover,
button[style*="rgb(249, 115, 22)"]:hover,
.btn-orange:hover {
    background: linear-gradient(135deg, #fb923c, #f59e0b) !important;
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4) !important;
    transform: translateY(-2px);
}

/* ======================================================
   🔐 LOGIN & 2FA PAGE STYLES (วางต่อท้ายไฟล์เดิมได้เลย)
   ====================================================== */

/* 1. จัดพื้นหลังหน้า Login ให้เต็มจอและมีแสงออร่าโทนสว่าง */
body.login-page {
    background-color: #f1f5f9;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.05), transparent 40%), 
        radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.05), transparent 40%);
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* 2. กล่อง Login แบบกระจกใสโทนสว่าง (Glassmorphism Light) */
.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.8); /* สีขาวโปร่งแสง */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 1);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* เส้นขอบด้านบนสีทองสวยๆ */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold));
}

/* 3. ส่วนหัว (Logo / Title) */
.login-header {
    margin-bottom: 30px;
}
.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-main);
    margin: 0;
}
.login-header p {
    color: var(--text-muted);
    font-size: 0.95em;
    margin-top: 8px;
}

/* 4. กล่องแจ้งเตือน Error */
.login-alert {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
    margin-bottom: 20px;
    text-align: left;
    font-weight: 500;
}

/* 5. จัดระเบียบช่องกรอกข้อมูล */
.login-form-group {
    text-align: left;
    margin-bottom: 20px;
}
.login-form-group label {
    display: block;
    color: var(--text-sub);
    font-size: 0.85em;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    font-weight: 700;
}
.login-form-group input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
}
.login-form-group input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

/* 6. ปุ่ม Login สีทอง (เฉพาะหน้า Login) */
button.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-gold), #b45309) !important;
    color: #fff !important;
    border: none !important;
    padding: 14px !important;
    font-size: 1.05em !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(180, 83, 9, 0.2) !important;
    margin-top: 10px;
    transition: all 0.2s !important;
}
button.btn-login:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 25px rgba(180, 83, 9, 0.3) !important;
}

/* 7. ลิงก์ด้านล่าง */
.login-footer {
    margin-top: 25px;
    font-size: 0.9em;
    color: var(--text-muted);
}
.login-footer a {
    color: var(--text-sub);
    font-weight: 600;
}
.login-footer a:hover {
    color: var(--accent-gold);
}

/* =========================================
   🌟 Premium Brand Logo Styles (PARM X - Light Version)
========================================= */
.brand-logo-container {
    padding: 10px 0 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-title {
    font-family: 'Kanit', sans-serif;
    margin: 0;
    display: flex;
    align-items: center;
    line-height: 1;
}

.text-parm {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main); /* เปลี่ยนเป็นสีเข้ม */
    letter-spacing: 2px;
}

.text-x {
    font-size: 2.8rem;
    font-weight: 900;
    font-style: italic;
    margin-left: 8px;
    background: linear-gradient(to right, #bf953f, #d97706, #b38728, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0px 2px 4px rgba(217, 119, 6, 0.2));
}

.brand-subtitle {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    margin-top: 8px;
}


/* =========================================
   CSS สำหรับเมนูหลักแบบหด-ขยายได้
   ========================================= */
.sidebar-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 15px 0 10px 0;
    outline: none;
}
.sidebar-dropdown-btn .sec-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.sidebar-dropdown-btn:hover .sec-title {
    color: #e2e8f0;
}
.sidebar-dropdown-btn .arrow {
    width: 14px;
    height: 14px;
    color: #64748b;
    transition: transform 0.3s ease;
}
/* หมุนลูกศรเมื่อกางเมนู (พ่วงกับ active) */
.sidebar-dropdown-btn.active .arrow {
    transform: rotate(180deg);
    color: #e2e8f0;
}

/* กล่องเก็บเมนูย่อย */
.sidebar-submenu {
    display: none; /* ซ่อนไว้ค่าเริ่มต้น */
    flex-direction: column;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,0.08);
    margin-left: 5px;
    margin-bottom: 10px;
}
/* แสดงเมื่อกดปุ่ม (พ่วงกับ show) */
.sidebar-submenu.show {
    display: flex; 
}