/* =========================================================
   LOGIN MODAL STYLES (ส่วนของกล่องเข้าสู่ระบบ - ธีมกระจกทึบสี)
========================================================= */

/* ------------------ ส่วนโครงสร้างและพื้นหลัง (Wrapper & Overlay) ------------------- */
.wrap-modal1 {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 9999;
}

.container-modal-center {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 15px;
    z-index: 2;
}

/* พื้นหลังเบลอ */
.overlay-modal1 {
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* ดรอปสีพื้นหลังให้มืดลงนิดหน่อยเพื่อให้สีกระจกเด่นขึ้น */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ------------------ ส่วนของกรอบ Card (เอฟเฟกต์กระจก) ------------------- */
.bg-dark-custom {
    background-color: rgba(255, 255, 255, 0.4); /* กระจกสีสว่างโปร่งแสง */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3); /* ขอบกระจก */
    border-radius: 20px;
    padding: 50px 40px;
    max-width: 450px;
    width: 100%;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15); /* เงาฟุ้งๆ ให้ดูมีมิติ */
}

/* ------------------ ส่วนปุ่มกากบาทมุมขวาบน (Close Button) ------------------- */
.btn-close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: #ffffff; 
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-close-modal:hover {
    opacity: 1;
}

/* ------------------ ส่วนข้อความหัวข้อ (Header Text) ------------------- */
.txt-header-modal {
    color: #1e3a8a !important; /* สีน้ำเงินเข้มให้เข้าธีม */
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 0;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

/* ------------------ ส่วนของเส้นคั่นต่างๆ (Dividers) ------------------- */
.line-divider {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 0px; 
    margin-bottom: 25px;
    width: 100%;
}

.or-divider {
    display: flex;
    align-items: center;
    color: #444;
    font-size: 14px;
    font-weight: 500;
}

.or-divider::before, .or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.15);
}

.or-divider span {
    padding: 0 15px;
}
/* =========================================================
   โหมดมืด (Dark Mode : ดึงสไตล์เดิมมาใช้ เมื่อมีคลาส .dark-theme)
========================================================= */
.dark-theme .overlay-modal1 {
    background-color: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dark-theme .bg-dark-custom {
    background-color: #1e2129;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 15px 50px rgba(0,0,0,0.9);
}

.dark-theme .btn-close-modal {
    text-shadow: none;
}

.dark-theme .txt-header-modal {
    color: #ffffff !important;
    text-shadow: none;
}

.dark-theme .line-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .or-divider {
    color: #777;
}

.dark-theme .or-divider::before, 
.dark-theme .or-divider::after {
    background: #333;
}

.dark-theme .form-control-dark {
    background-color: #2c313c !important;
    border: 1px solid #3e4451 !important;
    color: #ffffff !important;
    box-shadow: none;
}

.dark-theme .form-control-dark:focus {
    background-color: #2c313c !important;
    border-color: #8b5cf6 !important;
}

.dark-theme .form-control-dark::placeholder {
    color: #9ba6b5 !important; 
}

.dark-theme .btn-login-purple {
    background-color: #8b5cf6;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.dark-theme .btn-login-purple:hover {
    background-color: #7c3aed;
    transform: none;
}

.dark-theme .btn-red-admin {
    background-color: #d94f3d;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.dark-theme .btn-red-admin:hover {
    background-color: #c24133;
    transform: none;
}

/* ------------------ ส่วนของตัวกรอกข้อมูล (Inputs: Username & Password) ------------------- */
.form-control-dark {
    background-color: rgba(255, 255, 255, 0.5) !important; /* ช่องกรอกแบบกระจกขุ่น */
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    color: #333333 !important;
    padding: 15px 20px !important;
    border-radius: 10px !important;
    width: 100%;
    font-size: 16px;
    margin-bottom: 5px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}

.form-control-dark:focus {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(37, 99, 235, 0.5) !important;
    outline: none;
}

.form-control-dark::placeholder {
    color: #6b7280 !important; 
}

.m-b-30 {
    margin-bottom: 30px !important;
}

/* ------------------ ส่วนของปุ่มกด (Buttons: สไตล์กระจกทึบสี) ------------------- */

/* ปุ่มเข้าสู่ระบบ (สีกระจกน้ำเงิน) */
.btn-login-purple {
    width: 100%;
    background-color: rgba(37, 99, 235, 0.75); /* สีน้ำเงินโปร่งแสง */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2); /* ขอบสว่างให้ดูเป็นกระจก */
    color: #ffffff;
    padding: 16px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.btn-login-purple:hover {
    background-color: rgba(29, 78, 216, 0.9);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

/* ปุ่มสมัครสมาชิก (สีกระจกแดง) */
.btn-red-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: rgba(220, 38, 38, 0.75); /* สีแดงโปร่งแสง */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
    padding: 15px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.3);
}

.btn-red-admin:hover {
    background-color: rgba(185, 28, 28, 0.9);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}

/* บังคับให้ปุ่มของ SweetAlert อยู่ตรงกลาง */
.swal-footer {
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
}

/* =========================================================
   USER PROFILE & NAVBAR (ส่วนของเมนูด้านบนและโปรไฟล์หลังล็อกอิน)
========================================================= */

/* ------------------ รูปโปรไฟล์ ------------------- */
.profile-avatar-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #8b5cf6;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.profile-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

#user-profile-section i {
    transition: color 0.3s;
}

#user-profile-section i:hover {
    color: #8b5cf6;
}

/* ------------------ Navbar Styling ------------------- */
.gap-20 { gap: 20px; } /* แก้ไขนำจุด . มาใส่ให้ถูกหลัก CSS Class */
.nav-username { cursor: pointer; color: #fff; font-weight: 600; }
.ticket-counter { color: #ccc; gap: 8px; font-size: 14px; }
.text-purple { color: #a64bf4; }

/* ------------------ เมนู Dropdown โปรไฟล์ ------------------- */
.user-dropdown { position: relative; display: inline-block; }

.profile-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 15px;
    background-color: #1a1a1d; 
    min-width: 250px;
    border-radius: 8px;
    box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
}

.show-profile-dropdown { display: block; } /* Class เปิดปิด Dropdown */

/* Header Detail ใน Dropdown */
.dropdown-user-header { padding: 15px 20px; }
.avatar-holder { width: 50px; height: 50px; border-radius: 50%; overflow: hidden; background: #333; margin-right: 15px; }
.user-info strong { color: #fff; font-size: 16px; display: block; }
.user-info span { color: #999; font-size: 12px; }

/* Wallet Section ใน Dropdown */
.wallet-section { padding: 10px 20px; }
.ticket-balance { font-size: 18px; color: #fff; gap: 5px; }
.btn-topup-purple { background: #a64bf4; color: #fff; border: none; padding: 8px 15px; border-radius: 5px; font-size: 12px; }

/* รายการเมนูย่อย (ชั้นหนังสือ, Admin, Out) */
.profile-dropdown-content a.dropdown-item {
    padding: 12px 20px; color: #ccc; text-decoration: none; display: flex; align-items: center; transition: 0.3s;
}
.profile-dropdown-content a.dropdown-item:hover { background: #2a2a2e; color: #fff; }
.dropdown-item i { margin-right: 15px; width: 20px; text-align: center; font-size: 18px; }

/* เส้นคั่นใน Dropdown */
.dark-hr { border: 0; border-top: 1px solid #333; margin: 0; }
.separator { margin-top: 0; }

/* ------------------ Z-Index Fix (บังคับตำแหน่งด้านหน้า) ------------------- */
header, .header-area {
    position: relative;
    z-index: 9999 !important; 
}

.user-dropdown-menu {
    position: absolute;
    z-index: 10000 !important; 
}