:root {
    --primary: #444;
    --primary-rgb: 68, 68, 68;
    --primary-hover: #555;
    --bg-dark: #252525;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-dim: #a0a0a0;
    --nav-bg: rgba(26, 26, 26, 0.9);
    --error: #ff5f5f;
    --success: #4caf50;
    --font-main: 'Kanit';
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
button,
input,
select,
textarea,
span,
p,
div,
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-main) !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-main);
}

/* Navbar Style */
.navbar {
    width: 70%;
    max-width: 1200px;
    height: 64px;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    transition: all 0.3s ease;
}

@media (max-width: 1024px) {
    .navbar {
        width: 95%;
        top: 10px;
    }
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-center-menu {
    display: flex;
    gap: 25px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-menu-item {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-menu-item:hover {
    color: var(--text-main);
}

.nav-menu-item.active {
    color: white;
    font-weight: 600;
}

.nav-menu-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary);
}

.btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Container & Auth Cards */
.main-content {
    padding-top: 100px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 64px);
}

.auth-card {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.03);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    color: white;
}

.auth-subtitle {
    color: var(--text-dim);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i:not(.toggle-password) {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 0.9rem;
    pointer-events: none;
    /* ป้องกันไม่ให้ไอคอนบังการคลิกช่อง input */
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
    z-index: 10;
    padding: 5px;
    /* เพิ่มพื้นที่คลิกให้ไอคอนดวงตา */
}

.toggle-password:hover {
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 42px 12px 42px;
    /* เพิ่ม padding ทั้งซ้ายและขวาเพื่อให้มีพื้นที่สำหรับไอคอน */
    background-color: #121212;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.02);
}

/* Mobile/WebKit fix: prevent typed text from disappearing in admin inputs */
.admin-content-area .form-control,
.admin-content-area input,
.admin-content-area textarea,
.admin-content-area select,
.admin-content-area .swal2-input,
.admin-content-area .swal2-textarea {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    caret-color: #ffffff !important;
    opacity: 1 !important;
}

.admin-content-area .form-control::placeholder,
.admin-content-area input::placeholder,
.admin-content-area textarea::placeholder,
.admin-content-area .swal2-input::placeholder,
.admin-content-area .swal2-textarea::placeholder {
    color: rgba(255, 255, 255, 0.55) !important;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.55) !important;
}

.admin-content-area input:-webkit-autofill,
.admin-content-area input:-webkit-autofill:hover,
.admin-content-area input:-webkit-autofill:focus,
.admin-content-area textarea:-webkit-autofill,
.admin-content-area select:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: 0 0 0px 1000px #121212 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.submit-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.submit-btn.danger {
    background-color: var(--error);
}

.submit-btn.danger:hover {
    background-color: #d32f2f;
}

.btn-discord {
    background-color: #5865F2;
    color: white;
    border: none;
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

.btn-discord:hover {
    background-color: #4752c4;
    transform: translateY(-1px);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar Styles */
.sidebar-category-header {
    margin-top: 5px;
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.sidebar-category-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-category-header i.toggle-icon {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.sidebar-category-header.collapsed i.toggle-icon {
    transform: rotate(-90deg);
}

.sidebar-category-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s;
    max-height: 500px;
    opacity: 1;
}

.sidebar-category-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Switch Toggle Custom */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #4caf50;
}

input:focus+.slider {
    box-shadow: 0 0 1px #4caf50;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

/* Messages */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-error {
    background-color: rgba(255, 95, 95, 0.1);
    color: var(--error);
    border: 1px solid rgba(255, 95, 95, 0.2);
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success);
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.recovery-info {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.link-text {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
}

.link-text:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Dropdown Menu */
.user-menu {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: none;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
    z-index: 10000;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dropdown-item i {
    color: var(--text-dim);
}

.cf-verification {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Admin Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    /* เพิ่มความกว้างจาก 260px เป็น 280px */
    background-color: var(--card-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    /* สูงกว่า Navbar (9999) เพื่อให้อยู่ด้านบนสุด */
    overflow-x: hidden;
    padding-top: 10px;
}

@media (max-width: 1024px) {
    .sidebar {
        padding-top: 10px;
        /* เอา padding-top 80px ออกเพื่อให้ทับ Navbar ไปเลย */
    }
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.admin-layout {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 64px);
}

.admin-content-area {
    flex: 1;
    padding: 40px;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* ช่วยให้เนื้อหาตรงกลาง */
    overflow-x: hidden;
}

.admin-content-area>div {
    width: 100%;
    max-width: 100%;
}

.admin-table-container {
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.admin-table-container table {
    min-width: 760px;
}

/* เมื่อ Sidebar เปิดอยู่ (Desktop) */
.admin-layout:not(.sidebar-collapsed) .admin-content-area {
    padding-left: 320px;
    /* sidebar width + padding */
}

/* เมื่อ Sidebar ปิดอยู่ */
.admin-layout.sidebar-collapsed .admin-content-area {
    padding-left: 40px;
}

@media (max-width: 1024px) {
    .admin-layout:not(.sidebar-collapsed) .admin-content-area {
        padding-left: 40px;
        /* บนจอเล็กไม่ดันเนื้อหา แต่ให้ทับซ้อนแทน */
    }

    .sidebar {
        width: min(86vw, 320px);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .admin-content-area {
        align-items: stretch;
        padding: 24px 15px;
    }
}

@media (max-width: 768px) {
    .admin-content-area {
        padding: 16px 10px;
        align-items: stretch;
    }

    .admin-layout.sidebar-collapsed .admin-content-area {
        padding-left: 10px;
    }

    .admin-content-area .auth-card {
        max-width: none !important;
        padding: 18px 12px !important;
        border-radius: 12px;
    }

    .admin-content-area .modal-content {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        margin: 10px !important;
        padding: 18px 12px !important;
        border-radius: 14px;
    }

    .admin-content-area td[style*="text-overflow: ellipsis"] {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .admin-content-area [style*="grid-template-columns: 1fr 1fr auto auto"],
    .admin-content-area [style*="grid-template-columns: 1fr 1fr 1fr"],
    .admin-content-area [style*="grid-template-columns: 1fr 1fr"],
    .admin-content-area [style*="grid-template-columns: repeat(3, 1fr)"],
    .admin-content-area [style*="minmax(350px"],
    .admin-content-area [style*="minmax(320px"],
    .admin-content-area [style*="minmax(300px"],
    .admin-content-area [style*="minmax(250px"],
    .admin-content-area [style*="minmax(220px"],
    .admin-content-area [style*="minmax(200px"] {
        grid-template-columns: 1fr !important;
    }

    .admin-content-area .admin-table-container table {
        min-width: 680px;
    }
}

.sidebar-toggle-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--primary);
    color: white;
}

/* ปุ่มตอนพับเก็บจะลอยอยู่ที่มุมซ้ายบนของจอ */
.sidebar-toggle-btn.floating {
    position: fixed;
    left: 15px;
    top: 74px;
    background: var(--primary);
    color: white;
}

/* Responsive Design */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-decoration: none;
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    /* จำกัดความสูงไว้ที่ 85% ของหน้าจอ */
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    /* เพิ่ม Scrollbar แนวตั้งถ้าเนื้อหายาวเกินไป */
    padding: 35px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* เพิ่มเติมสำหรับ Modal เติมเงินให้กว้างขึ้นเพื่อรองรับปุ่มบรรทัดเดียว */
#topupModal .modal-content {
    max-width: 650px;
}

@media (max-width: 600px) {
    .modal-overlay {
        padding: 10px;
        /* ลด padding รอบ modal เพื่อให้กว้างขึ้น */
    }

    #topupModal.modal-overlay {
        padding: 6px;
    }

    .modal-content {
        padding: 20px 15px;
        border-radius: 20px;
        width: 100%;
        /* ให้กว้างเต็มจอ */
    }

    #topupModal .modal-content {
        width: calc(100vw - 12px);
        max-width: none;
        padding: 18px 12px;
    }

    .topup-tabs {
        flex-wrap: nowrap;
        overflow-x: visible;
        background: transparent;
        padding: 0;
        gap: 8px;
        display: grid;
        grid-template-columns: 1fr;
    }

    .topup-tab-btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        background: rgba(0, 0, 0, 0.2);
        padding: 12px 12px;
        font-size: 0.8rem;
        border-radius: 12px;
        white-space: normal;
        /* ยอมให้ข้อความขึ้นบรรทัดใหม่ได้ในปุ่ม */
        word-break: break-word;
        text-align: center;
        line-height: 1.2;
    }

    .topup-tab-btn i {
        font-size: 1rem;
        display: block;
        /* ให้ไอคอนอยู่ด้านบนข้อความเพื่อให้ประหยัดเนื้อที่แนวนอน */
        margin-bottom: 5px;
        margin-right: 0;
    }
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

.modal-header i {
    color: var(--primary);
    font-size: 1.6rem;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: #ff5f5f;
    border-color: #ff5f5f;
}

.modal-header h3 {
    font-size: 1rem;
    /* ปรับขนาดฟอนต์หัวข้อให้พอดีกับจอเล็ก */
    font-weight: 600;
    color: white;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.close-modal:hover {
    color: white;
}

.modal-body {
    padding: 15px 20px;
    /* ลด padding ลงเพื่อให้มีพื้นที่แสดงผลมากขึ้น */
}

.topup-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.topup-tabs::-webkit-scrollbar {
    display: none;
}

.topup-tab-btn {
    flex: 1;
    min-width: max-content;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.topup-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tab-panel {
    display: none;
    min-height: 200px;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

.swal2-front {
    z-index: 9999 !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .nav-center-menu {
        display: none;
        /* ซ่อนเมนูตรงกลางบนหน้าจอขนาดเล็กเพื่อไม่ให้ทับซ้อน */
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 10px;
        gap: 5px;
    }

    .logo {
        font-size: 0.95rem;
        white-space: nowrap;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .nav-links>a.btn {
        display: none;
        /* ซ่อนปุ่ม Login/Register ใน Navbar บนมือถือ */
    }

    .auth-card {
        padding: 25px 20px;
        margin: 20px;
        max-width: 90%;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .settings-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 10px);
        text-align: center;
        font-size: 0.75rem;
    }
}

/* Mobile Drawer */
.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    backdrop-filter: blur(4px);
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-dark);
    z-index: 2001;
    transition: all 0.3s ease;
    padding: 30px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-drawer.active {
    left: 0;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 1rem;
    padding: 12px 15px;
    border-radius: 10px;
    transition: background 0.2s;
}

.drawer-item:hover,
.drawer-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 1024px) {
    .nav-center-menu {
        display: none;
    }

    .hamburger-btn {
        display: block;
    }
}



/* Global Responsive Utilities */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

img {
    max-width: 100%;
    height: auto;
}

/* Fix for long URLs or text breaking layout */
.text-break {
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Main Slider Styles */
.main-slider-container {
    width: 70%;
    max-width: 1200px;
    aspect-ratio: 1640 / 500;
    margin: 100px auto 0;
    /* เปลี่ยน margin-bottom เป็น 0 */
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #1a1a1a;
    display: none;
}

@media (max-width: 1024px) {
    .main-slider-container {
        width: 95%;
        margin-top: 85px;
        border-radius: 15px;
    }
}

.slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-frame {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.slide-frame img,
.slide-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
}

.slider-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-indicator.active {
    background: var(--primary);
    width: 25px;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary);
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    opacity: 0;
    transition: all 0.3s ease;
}

.main-slider-container:hover .slider-arrow {
    opacity: 1;
}

.slider-arrow:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.slider-arrow.prev-arrow {
    left: 20px;
}

.slider-arrow.next-arrow {
    right: 20px;
}

/* Announcement Bar Styles */
.announcement-bar {
    width: 55%;
    max-width: 1200px;
    margin: 15px auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.announcement-icon {
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: var(--bg-dark);
    padding: 5px 10px;
    border-radius: 8px;
}

.announcement-wrapper {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.announcement-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 30s linear infinite;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 400;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

@media (max-width: 1024px) {
    .announcement-bar {
        width: 95%;
        margin-top: 10px;
    }
}

/* Home Stats Styles */
.home-stats-container {
    width: 55%;
    max-width: 1200px;
    margin: 0 auto 20px auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.home-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.home-stat-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.home-stat-icon {
    width: 45px;
    height: 45px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.home-stat-info {
    display: flex;
    flex-direction: column;
}



.home-stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.home-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
}

@media (max-width: 1024px) {
    .home-stats-container {
        width: 95%;
    }
}



/* Help Buttons Styles */
.home-help-container {
    width: 55%;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.home-help-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    position: relative;
}

.home-help-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(var(--primary-rgb), 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.home-help-card:hover::before {
    opacity: 1;
}

.home-help-icon {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 2;
}

.home-help-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-help-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.home-help-full-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Section Header Styles */
.section-header-container {
    width: 55%;
    max-width: 1200px;
    margin: 30px auto 20px auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--primary);
    padding: 0 0 0 15px;
}

.section-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.section-header-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.section-header-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-top: -2px;
}

.section-header-btn {
    padding: 6px 16px;
    background: #000;
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: #ffffff !important;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid #333;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    text-transform: none;
}

.section-header-btn:hover {
    transform: translateY(-5px) scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(var(--primary-rgb), 0.6);
    background: #000;
}

.section-header-btn i {
    width: 22px;
    height: 22px;
    background: #222;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--primary);
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.section-header-btn:hover i {
    background: #ffffff;
    color: var(--primary);
    transform: rotate(360deg) scale(1.1);
}

/* Home Categories Styles */
.home-categories-container {
    width: 55%;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.category-card {
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
}

.category-image {
    width: 100%;
    aspect-ratio: 1640 / 500;
    overflow: hidden;
    background: #000;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
    opacity: 0.8;
}

.category-card:hover .category-image img {
    transform: scale(1.05);
    opacity: 1;
}

.category-body {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background: linear-gradient(180deg, rgba(21, 21, 21, 0) 0%, #151515 100%);
    margin-top: -15px;
    position: relative;
    z-index: 2;
}

.category-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.category-subtitle {
    font-size: 0.8rem;
    color: #888;
    margin: 0;
}

.category-action-btn {
    background: var(--primary);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.category-card:hover .category-action-btn {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

@media (max-width: 1200px) {

    .home-help-container,
    .section-header-container,
    .home-categories-container {
        width: 95%;
    }
}

@media (max-width: 1024px) {
    .home-help-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {

    /* Global Mobile Scaling */
    .btn span {
        display: none;
    }

    .btn i {
        margin: 0;
    }

    .navbar {
        padding: 0 10px;
    }

    .modal-content {
        width: 95% !important;
        margin: 10px !important;
        padding: 15px !important;
    }

    .topup-tab-btn {
        min-width: 100px;
        font-size: 0.75rem;
    }

    .auth-card {
        padding: 20px 15px !important;
        margin: 10px !important;
    }

    .logo {
        font-size: 0.85rem !important;
    }

    .nav-brand {
        gap: 8px !important;
    }

    .site-logo-container img,
    .site-logo-container video {
        height: 24px !important;
    }

    /* Stats Mobile Adjustment */
    .home-stats-container {
        grid-template-columns: 1fr;
        /* 1 แถบเท่านั้น */
        gap: 8px;
    }

    .home-stat-card {
        padding: 10px 15px;
    }

    .home-stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .home-stat-label {
        font-size: 0.65rem;
    }

    .home-stat-value {
        font-size: 1rem;
    }

    /* Help Buttons Mobile Adjustment */
    .home-help-container {
        grid-template-columns: repeat(2, 1fr);
        /* 1 แถว 2 ปุ่ม */
        gap: 8px;
    }

    .home-help-card {
        aspect-ratio: 16 / 9;
        padding: 10px;
    }

    .home-help-icon {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .home-help-label {
        font-size: 0.7rem;
    }

    /* Section Header Mobile Adjustment */
    .section-header-title {
        font-size: 1rem;
    }

    .section-header-btn {
        padding: 5px 10px;
        font-size: 0.7rem;
        gap: 5px;
    }

    .section-header-btn i {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }

    /* Categories Mobile Adjustment */
    .home-categories-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .category-body {
        padding: 15px;
        margin-top: -15px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
        gap: 10px;
    }

    .category-title {
        font-size: 0.95rem;
        margin-top: 5px;
    }

    .category-subtitle {
        font-size: 0.65rem;
    }

    .category-action-btn {
        width: auto;
        padding: 6px 15px;
        font-size: 0.75rem;
    }
}

/* Product Card Styles */
.home-products-container {
    width: 55%;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    align-items: start;
}

.product-card {
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    position: relative;
    height: auto !important;
    min-height: 0 !important;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #000;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.product-stock-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    font-size: 0.75rem;
    color: #fff;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    display: flex;
    flex-direction: column;
}

.price-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.price-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}

.buy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buy-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.buy-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    opacity: 0.7;
}

@media (max-width: 1200px) {
    .home-products-container {
        width: 95%;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        align-items: start;
    }
}

@media (max-width: 480px) {
    .product-name {
        font-size: 0.9rem;
    }

    .price-value {
        font-size: 1rem;
    }

    .buy-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

/* Product Detail Page Styles */
.detail-container {
    width: 65%;
    max-width: 1200px;
    margin: 40px auto;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
}

.detail-breadcrumb {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: -10px;
}

.detail-breadcrumb a {
    color: var(--text-dim);
    transition: color 0.3s;
}

.detail-breadcrumb a:hover {
    color: var(--primary);
}

.detail-image-side {
    width: 100%;
}

.detail-image-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #000;
}

.detail-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.detail-desc-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    min-height: 200px;
}

.detail-desc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-desc-content {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.8;
}

.detail-buy-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.qty-label {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.qty-input-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.qty-btn {
    background: none;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 1rem;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.qty-value {
    width: 60px;
    text-align: center;
    background: none;
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    outline: none;
}

.detail-stock-info {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.detail-buy-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
}

.detail-buy-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-3px);
}

.detail-buy-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

@media (max-width: 1024px) {
    .detail-container {
        width: 95%;
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .detail-breadcrumb {
        grid-column: 1;
    }

    .detail-title {
        font-size: 1.5rem;
    }
}

/* Mobile fix: ensure topup channel labels are fully visible */
@media (max-width: 600px) {
    #topupModal.modal-overlay {
        padding: 6px;
    }

    #topupModal .modal-content {
        width: calc(100vw - 12px) !important;
        max-width: none !important;
        padding: 18px 12px !important;
    }

    #topupModal .topup-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow: visible !important;
        padding: 0;
        background: transparent;
    }

    #topupModal .topup-tab-btn {
        width: 100%;
        min-width: 0 !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-align: left;
        justify-content: flex-start;
        align-items: flex-start;
        line-height: 1.25;
        padding: 10px 10px;
        background: rgba(0, 0, 0, 0.2);
    }

    #topupModal .topup-tab-btn i {
        display: inline-flex;
        margin: 2px 6px 0 0;
        flex: 0 0 auto;
    }
}

@media (max-width: 380px) {
    #topupModal .topup-tabs {
        grid-template-columns: 1fr;
    }
}