/* public/css/admin-luxury.css */

/* 1. Import ฟอนต์ */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&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 #0f172a inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* 2. ตั้งค่าตัวแปรสี (Theme Variables) */
:root {
    --bg-dark: #0f172a;        /* พื้นหลังหลัก (Dark Navy) */
    --bg-card: #1e293b;        /* พื้นหลังกล่อง (Slate) */
    --bg-sidebar: #0b1120;     /* พื้นหลังเมนูข้าง */
    --text-main: #e2e8f0;      /* สีตัวอักษรหลัก */
    --text-muted: #94a3b8;     /* สีตัวอักษรรอง */
    --accent-gold: #fbbf24;    /* สีทอง (ปรับให้สว่างขึ้นนิดนึงเพื่อให้เห็นชัดบนพื้นเข้ม) */
    --accent-blue: #3b82f6;    /* สีฟ้านีออน */
    --accent-green: #10b981;   /* สีเขียวสำเร็จ */
    --accent-red: #ef4444;     /* สีแดงแจ้งเตือน */
    --border-color: rgba(255, 255, 255, 0.05); /* เส้นขอบแบบจางๆ */
}

/* 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;
}

.side h3 {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0 25px 0;
    font-size: 1.2rem;
}

/* หัวข้อหมวดหมู่ */
.side .sec {
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 25px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* ลิงก์เมนู */
.side a {
    display: flex;
    align-items: center;
    gap: 12px; /* ระยะห่างระหว่างไอคอนกับข้อความ */
    padding: 12px 15px;
    color: #cbd5e1;
    border-radius: 8px;
    font-weight: 400;
    margin-bottom: 5px;
    border: 1px solid transparent; /* เตรียมเส้นขอบไว้ */
    transition: all 0.2s ease;
}

/* Effect ตอนเอาเมาส์ชี้ */
.side a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(5px); /* ขยับขวาเล็กน้อย */
    border-color: rgba(255, 255, 255, 0.1);
}

/* ไอคอน SVG */
.menu-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: 0.2s;
}

.side a:hover .menu-icon {
    opacity: 1;
    color: var(--accent-gold); /* เปลี่ยนไอคอนเป็นสีทอง */
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.5)); /* เรืองแสงนิดๆ */
}

.side hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.side .small {
    font-size: 0.8em;
    color: #64748b;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* ปุ่ม Logout แบบใหม่ */
.btn-logout {
    width: 100%;
    margin-top: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fff;
    border-color: var(--accent-red);
}

/* =========================================
   6. MAIN CONTENT STYLES
   ========================================= */
.main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-main);
    /* เอาเส้นข้างออก เพื่อให้ดูโมเดิร์นขึ้น (หรือจะเก็บไว้ก็ได้) */
    /* border-left: 5px solid var(--accent-gold); */
    /* padding-left: 15px; */
}

/* --- Components --- */
.card-container {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Badge (ป้ายสถานะ/ตัวเลข) */
.badge {
    padding: 4px 8px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    min-width: 18px;
    text-align: center;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.badge-pending { background: rgba(212, 175, 55, 0.2); color: var(--accent-gold); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

/* Alerts */
.ok { 
    background: rgba(16, 185, 129, 0.1); 
    color: var(--accent-green); 
    padding: 15px; 
    border-radius: 8px; 
    border: 1px solid rgba(16, 185, 129, 0.2); 
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.err { 
    background: rgba(239, 68, 68, 0.1); 
    color: var(--accent-red); 
    padding: 15px; 
    border-radius: 8px; 
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}

/* Form Elements */
input[type="text"], input[type="search"], input[type="password"] {
    background-color: #0f172a;
    border: 1px solid #334155;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    outline: none;
    transition: border 0.3s;
}
input:focus { border-color: var(--accent-blue); }

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: #94a3b8; font-weight: 500; text-transform: uppercase; font-size: 0.85em; border-bottom: 1px solid var(--border-color); }
td { padding: 15px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }

/* ======================================================
   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.4) !important;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    transition: all 0.3s ease;
}

/* 2. เอฟเฟกต์ตอนเอาเมาส์ชี้ */
button[type="submit"]:hover,
input[type="submit"]:hover {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6) !important;
    transform: translateY(-2px);
}

/* 3. (เผื่อไว้) ถ้าปุ่มนั้นใช้แท็ก <a> แต่อยากให้เขียวด้วย */
a.btn-confirm {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
}

/* ======================================================
   FIX LOGOUT BUTTON (แก้ปุ่ม Logout ให้กลับเป็นสีแดง)
   ====================================================== */
button.btn-logout {
    background: rgba(239, 68, 68, 0.1) !important; /* พื้นหลังแดงจาง */
    border: 1px solid rgba(239, 68, 68, 0.2) !important; /* ขอบแดง */
    color: #fca5a5 !important; /* ตัวหนังสือแดงอ่อน */
    box-shadow: none !important; /* เอาเงาเขียวออก */
    margin-top: 20px !important;
}

button.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2) !important; /* แดงเข้มขึ้นตอนชี้ */
    color: #ffffff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4) !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.4) !important;
    border: none !important;
    color: #fff !important;
}

button[style*="#ef4444"]:hover,
button[style*="rgb(239, 68, 68)"]:hover,
.btn-red:hover {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6) !important;
    transform: translateY(-2px);
}

/* 2. แก้ปุ่มรีเซ็ต (สีส้ม) ให้ชนะสีเขียว */
button[style*="#f97316"],
button[style*="rgb(249, 115, 22)"],
.btn-orange {
    background: linear-gradient(135deg, #f97316, #c2410c) !important;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.4) !important;
    border: none !important;
    color: #fff !important;
}

button[style*="#f97316"]:hover,
button[style*="rgb(249, 115, 22)"]:hover,
.btn-orange:hover {
    background: linear-gradient(135deg, #fb923c, #f97316) !important;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.6) !important;
    transform: translateY(-2px);
}

/* ======================================================
   🔐 LOGIN & 2FA PAGE STYLES (วางต่อท้ายไฟล์เดิมได้เลย)
   ====================================================== */

/* 1. จัดพื้นหลังหน้า Login ให้เต็มจอและมีแสงออร่า */
body.login-page {
    background-color: var(--bg-dark);
    /* สร้างพื้นหลังแบบไล่เฉดสี Luxury */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15), transparent 40%), /* แสงสีฟ้าซ้ายบน */
        radial-gradient(circle at 90% 80%, rgba(251, 191, 36, 0.1), transparent 40%);  /* แสงสีทองขวาล่าง */
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

/* 2. กล่อง Login แบบกระจกใส (Glassmorphism) */
.login-card {
    width: 100%;
    max-width: 400px; /* ความกว้างกล่อง */
    background: rgba(30, 41, 59, 0.7); /* สีพื้นหลังโปร่งแสง */
    backdrop-filter: blur(20px);       /* เบลอฉากหลัง */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1); /* ขอบจางๆ */
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* เงาฟุ้งๆ */
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* เส้นขอบด้านบนสีทองสวยๆ */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold));
}

/* 3. ส่วนหัว (Logo / Title) */
.login-header {
    margin-bottom: 30px;
}
.login-header h1 {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #fff;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.login-header p {
    color: #94a3b8;
    font-size: 0.9em;
    margin-top: 5px;
}

/* 4. กล่องแจ้งเตือน Error */
.login-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85em;
    margin-bottom: 20px;
    text-align: left;
}

/* 5. จัดระเบียบช่องกรอกข้อมูล */
.login-form-group {
    text-align: left;
    margin-bottom: 20px;
}
.login-form-group label {
    display: block;
    color: #cbd5e1;
    font-size: 0.85em;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.login-form-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    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 3px rgba(251, 191, 36, 0.1);
    background: rgba(15, 23, 42, 0.9);
}

/* 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: 1em !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(180, 83, 9, 0.4) !important;
    margin-top: 10px;
    transition: transform 0.2s !important;
}
button.btn-login:hover {
    transform: translateY(-2px) !important;
    background: linear-gradient(135deg, #fbbf24, #d97706) !important;
    box-shadow: 0 15px 30px -5px rgba(180, 83, 9, 0.6) !important;
}

/* 7. ลิงก์ด้านล่าง */
.login-footer {
    margin-top: 25px;
    font-size: 0.85em;
    color: #64748b;
}
.login-footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}
.login-footer a:hover {
    color: var(--accent-gold);
}