/* =======================================================
   🏥 CLINIC ENTERPRISE SYSTEM - GLOBAL STYLES (Clean Layout)
======================================================= */
body { background-color: #f4f7fa; font-family: 'Noto Sans Lao', sans-serif; margin: 0; }

#login-screen { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a2235 0%, #3498db 100%); }
.login-box { background: white; padding: 40px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); width: 100%; max-width: 400px; text-align: center; }
#main-app { display: none; }

#wrapper { display: flex; height: 100vh; overflow: hidden; transition: all 0.3s ease; }
:root { --app-sidebar-bg: #0f172a; }
#sidebar-wrapper { width: 260px; min-width: 260px; background-color: #013431 !important; color: white; display: flex; flex-direction: column; transition: all 0.3s ease; z-index: 1000; height: 100vh !important; }
#wrapper.toggled #sidebar-wrapper { margin-left: -260px; }
#page-content-wrapper { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; transition: all 0.3s ease; width: 100%; }

.sidebar-heading { padding: 30px 20px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.sidebar-menu { flex-grow: 1; overflow-y: auto; padding-top: 15px; padding-bottom: 20px; }
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.sidebar-link { color: #94a3b8; text-decoration: none; padding: 12px 25px; display: flex; align-items: center; font-size: 15px; transition: 0.2s; }
.sidebar-link i { width: 30px; font-size: 18px; }
.sidebar-link:hover { color: white; background-color: rgba(255,255,255,0.05); }
.sidebar-link.active { color: white; background-color: rgba(255,255,255,0.1); border-left: 4px solid #3498db; }
.sidebar-footer { margin-top: auto; padding: 15px 20px; background-color: #0d111a; border-top: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: space-between; z-index: 10; }
.top-navbar { background-color: white; padding: 15px 30px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; z-index: 100; }

#sidebarLogo, #loginLogo, #logoPreview { border-radius: 50% !important; background-color: #ffffff !important; object-fit: contain !important; aspect-ratio: 1 / 1 !important; padding: 2px !important; }
#sidebarLogo { width: 90px !important; height: 90px !important; margin: 0 auto 15px auto !important; border: 2px solid rgb(255, 255, 255) !important; }
#loginLogo { width: 120px !important; height: 120px !important; margin: 0 auto 15px auto !important; border: 2px solid #ffffff !important; box-shadow: 0 5px 10px rgba(0,0,0,0.2) !important; }

input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cursor-pointer { cursor: pointer; transition: all 0.2s; }
.cursor-pointer:hover { filter: brightness(0.8); color: #0d6efd; }
.hover-zoom { transition: all 0.2s; }
.hover-zoom:hover { transform: scale(1.05); }

.table-scrollable, .tab-pane .table-responsive { max-height: 60vh; overflow-y: auto; border-radius: 8px; }
.table-scrollable thead th, .table-custom thead th { position: sticky; top: 0; z-index: 10; background-color: #f8f9fa !important; box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); }
.table-scrollable::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scrollable::-webkit-scrollbar-track { background: transparent; }
.table-scrollable::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

input[type="date"], input[type="month"] { position: relative; padding-left: 10px; }
input[type="date"]::-webkit-datetime-edit-text, input[type="date"]::-webkit-datetime-edit-month-field, input[type="date"]::-webkit-datetime-edit-day-field, input[type="date"]::-webkit-datetime-edit-year-field,
input[type="month"]::-webkit-datetime-edit-text, input[type="month"]::-webkit-datetime-edit-month-field, input[type="month"]::-webkit-datetime-edit-year-field { display: none; }
input[type="date"]:before, input[type="month"]:before { content: attr(data-date); display: inline-block; color: #495057; position: absolute; top: 50%; transform: translateY(-50%); left: 10px; pointer-events: none; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator { position: absolute; right: 10px; color: #0d6efd; cursor: pointer; opacity: 1; }

body.staff-mode .btn-primary, body.staff-mode .btn-success, body.staff-mode .btn-info,
body.staff-mode [onclick*="openAdd"], body.staff-mode [onclick*="export"], body.staff-mode [onclick*="import"],
body.staff-mode [for="crmExcelInput"], body.staff-mode #crmExcelInput { display: none !important; }
body { padding-right: 0 !important; }
body.swal2-shown, body.modal-open { overflow-y: hidden !important; padding-right: 0 !important; }

/* Desktop Fixes */
@media (min-width: 769px) {
    .sidebar-mobile-close, .btn-close-sidebar { display: none !important; opacity: 0 !important; pointer-events: none !important; }
}
body.staff-mode #menu-toggle { display: flex !important; }
#menu-toggle { padding: 0 !important; display: flex !important; justify-content: center !important; align-items: center !important; }
#menu-toggle i { margin: 0 !important; padding: 0 !important; line-height: 1 !important; }


/* =======================================================
   🚀 ລະບົບປິດ-ເປີດ ຫຼາຍສາຂາ (SaaS Feature Toggle)
======================================================= */
/* ເມື່ອ Body ຖືກຕິດປ້າຍວ່າ 'single-branch-mode' 
   ທຸກຢ່າງທີ່ມີ Class 'multi-branch-only' ຈະຫາຍໄປທັນທີ! */
body.single-branch-mode .multi-branch-only {
    display: none !important;
}


/* =======================================================
   🌟 ປັບແຕ່ງແຖບ Tabs ໜ້າລາຍງານ ໃຫ້ເປັນກ່ອງງາມໆ (Box Tabs)
======================================================= */
#reportTabs {
    background-color: #f1f5f9; 
    padding: 6px;
    border-radius: 12px;
    display: inline-flex;
    border: 1px solid #e2e8f0;
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
}
#reportTabs .nav-item { margin: 0; }
#reportTabs .nav-link {
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 25px !important;
    color: #64748b !important;
    font-weight: bold !important;
    background: transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}
#reportTabs .nav-link:hover { background-color: #e2e8f0; color: #334155 !important; }
#reportTabs .nav-link.active {
    background-color: #ffffff !important;
    color: #0d6efd !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}


/* ==================================================================================
   📱📱📱 ໂໝດມືຖື (MOBILE RESPONSIVE) 📱📱📱
================================================================================== */
@media (max-width: 768px) {

    /* 1. ແກ້ບັນຫາ SCROLL: ປົດລັອກຄວາມສູງໃຫ້ປັດລົງໄດ້ຈົນສຸດ 100% */
    html, body { height: auto !important; min-height: 100vh !important; }
    #wrapper { height: auto !important; min-height: 100vh !important; overflow: visible !important; }
    #page-content-wrapper { height: auto !important; overflow: visible !important; padding: 10px 5px 80px 5px !important; }
    
    .container, .container-fluid { padding-left: 0 !important; padding-right: 0 !important; }
    .card { margin-left: 5px !important; margin-right: 5px !important; width: calc(100% - 10px) !important; border-radius: 12px !important; }
    .tab-content, .tab-pane { height: auto !important; max-height: none !important; overflow: visible !important; }

    /* Sidebar Mobile */
    #sidebar-wrapper { margin-left: -260px; position: fixed; height: 100vh !important; z-index: 1050; }
    #wrapper.toggled #sidebar-wrapper { margin-left: 0; }
    #wrapper.toggled #page-content-wrapper { opacity: 0.5; pointer-events: none; }
    .top-navbar { padding: 10px !important; }

    .sidebar-mobile-close, .btn-close-sidebar {
        display: flex !important; position: absolute !important; top: 15px !important; right: 15px !important; width: 36px !important; height: 36px !important;
        background-color: rgba(255, 255, 255, 0.1) !important; color: #ffffff !important; border-radius: 50% !important; align-items: center !important;
        justify-content: center !important; border: none !important; font-size: 18px !important; z-index: 1050 !important; cursor: pointer !important;
    }
    .sidebar-mobile-close:active, .btn-close-sidebar:active { background-color: #ff4d4d !important; }

    /* Tables (ປົດລັອກ Scroll ຕາຕະລາງ) */
    .table-responsive { max-height: none !important; display: block !important; width: 100% !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; border: none !important; }
    .table th, .table td, .table-responsive table th, .table-responsive table td { white-space: nowrap !important; vertical-align: middle !important; padding: 10px !important; }

    /* Date Inputs ໃຫ້ເຊື່ອງຕົວໜັງສືພາສາອັງກິດ */
    input[type="date"], input[type="month"] { color: transparent !important; }
    input[type="date"]::before, input[type="month"]::before { color: #495057 !important; }
    input[type="date"]:focus, input[type="month"]:focus { color: #495057 !important; }
    input[type="date"]:focus::before, input[type="month"]:focus::before { display: none !important; }

    /* Tabs ໃຫ້ລຽງແຖວດຽວກັນ */
    .nav-pills, .nav-tabs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; white-space: nowrap !important; padding-bottom: 5px; }
    .nav-pills .nav-item, .nav-tabs .nav-item { flex: 0 0 auto !important; }

    /* ປັບຂະໜາດຕົວເລກໜ້າລາຍງານ ແລະ ໜ້າການເງິນບໍ່ໃຫ້ລົ້ນຈໍ */
    h4 { font-size: 1.15rem !important; white-space: nowrap !important; }

    /* ຈັດປຸ່ມຕ່າງໆ ໃຫ້ເຕັມຈໍໃນມືຖື */
    .card-body > .d-flex .btn, .card-body .btn-warning { width: 100% !important; margin: 0 0 10px 0 !important; }

    /* =======================================================
       🌟 ປັບແຕ່ງປະຕິທິນ (FullCalendar) ໃນມືຖື
    ======================================================= */
    .fc .fc-toolbar {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        margin-bottom: 10px !important;
    }
    .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 5px !important;
        width: 100% !important;
    }
    .fc .fc-button {
        padding: 6px 12px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
        text-transform: capitalize !important;
    }
    .fc-toolbar-title {
        font-size: 1.25rem !important;
        text-align: center !important;
        width: 100% !important;
        color: #084298 !important;
    }
    .fc-view-harness { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .fc-scrollgrid { min-width: 600px !important; }

    /* ---------------------------------
       🌟 ແກ້ໄຂໜ້າ POS: ຫຍໍ້ກ່ອງເລືອກສິນຄ້າທີ່ຍາວເກີນໄປ
    --------------------------------- */
    .tab-content .tab-pane > div[style*="min-height"],
    .tab-content .tab-pane > div[style*="height"],
    .card-body:has(.nav-tabs) .tab-content {
        min-height: 120px !important; 
        max-height: 45vh !important;  
        height: auto !important;
        overflow-y: auto !important;  
        -webkit-overflow-scrolling: touch;
    }

    /* 🌟 ເຊື່ອງໂຕໜັງສື "Multi-Branch" ເມື່ອຢູ່ໃນມືຖື 🌟 */
        .saas-toggle-label span {
            display: none !important;
        }
        
        /* ປັບຂະໜາດກ່ອງຂອງປຸ່ມສະວິດໃຫ້ນ້ອຍລົງ ເພື່ອໃຫ້ພໍດີກັບໄອຄອນຢ່າງດຽວ */
        #saasModeToggleContainer {
            padding: 5px 10px !important; /* ຫຼຸດ Padding ລົງ */
        }
        
        /* ຖ້າໄອຄອນ (icon) ຍັງໃຫຍ່ໄປ ກໍສາມາດຫຼຸດຂະໜາດລົງໄດ້ໜ້ອຍໜຶ່ງ */
        .saas-toggle-label i {
            margin-right: 0 !important; /* ເອົາໄລຍະຫ່າງເບື້ອງຂວາອອກ ເພາະບໍ່ມີໂຕໜັງສືແລ້ວ */
        }
        /* ເມື່ອປຸ່ມ Switch ຖືກເປີດ ໃຫ້ໂຕໜັງສືປ່ຽນເປັນສີຂຽວ */
                #globalBranchToggleNavbar:checked ~ .saas-toggle-label {
                    color: #198754 !important; /* ສີຂຽວ (Success) */
                }

                /* ເມື່ອປຸ່ມ Switch ຖືກປິດ ໃຫ້ໂຕໜັງສືປ່ຽນເປັນສີເທົາ */
                #globalBranchToggleNavbar:not(:checked) ~ .saas-toggle-label {
                    color: #6c757d !important; /* ສີເທົາ (Secondary) */
                }

}

/* =======================================================
   💎 Premium SaaS Toggle Switch (ອອກແບບໃໝ່)
======================================================= */
.premium-saas-toggle {
    display: flex;
    align-items: center;
    background: #ffffff;
    padding: 4px 14px 4px 6px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
}

.premium-saas-toggle:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.premium-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    margin-right: 10px;
}

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

.premium-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; /* ສີຕອນປິດ (ສາຂາດຽວ) */
    transition: .4s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 34px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.premium-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ເວລາເປີດ (ຫຼາຍສາຂາ) ປ່ຽນເປັນສີຟ້າ */
.premium-switch input:checked + .premium-slider {
    background-color: #0d6efd; 
}

/* ແອນິເມຊັນເລື່ອນປຸ່ມ */
.premium-switch input:checked + .premium-slider:before {
    transform: translateX(18px);
}

.premium-toggle-label {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    transition: color 0.3s ease;
    user-select: none;
    display: flex;
    align-items: center;
}

/* ສະລັບໄອຄອນ: ປິດໂຊຮ້ານດຽວ, ເປີດໂຊເຄືອຂ່າຍ */
.icon-multi { display: none; margin-right: 5px; }
.icon-single { display: inline-block; margin-right: 5px; }

.premium-switch input:checked ~ .premium-toggle-label {
    color: #0d6efd; /* ໂຕໜັງສືປ່ຽນເປັນສີຟ້າເວລາກົດເປີດ */
}
.premium-switch input:checked ~ .premium-toggle-label .icon-multi { display: inline-block; }
.premium-switch input:checked ~ .premium-toggle-label .icon-single { display: none; }


/* =======================================================
   📱 ໂໝດມືຖື (ເຊື່ອງໂຕໜັງສືໃຫ້ເຫຼືອແຕ່ປຸ່ມລ້ວນໆ)
======================================================= */
@media (max-width: 768px) {
    .premium-saas-toggle {
        padding: 3px; /* 🌟 ຫຼຸດ padding ລົງອີກເພື່ອໃຫ້ນ້ອຍລົງ */
    }
    .premium-switch {
        margin-right: 0; 
        width: 38px; /* 🌟 ຫຼຸດຄວາມກວ້າງຂອງປຸ່ມລົງໜ້ອຍໜຶ່ງ */
        height: 22px; /* 🌟 ຫຼຸດຄວາມສູງລົງໜ້ອຍໜຶ່ງ */
    }
    .premium-slider:before {
        height: 16px; /* 🌟 ປັບຂະໜາດວົງມົນທາງໃນ */
        width: 16px;
        left: 3px;
        bottom: 3px;
    }
    .premium-switch input:checked + .premium-slider:before {
        transform: translateX(16px); /* 🌟 ປັບໄລຍະການເລື່ອນໃຫ້ພໍດີກັບຂະໜາດໃໝ່ */
    }
    .premium-toggle-label {
        display: none; 
    }
}


/* =======================================================
   🌟 ປັບແຕ່ງໜ້າ ພະນັກງານ (HR & Timesheet) ສຳລັບມືຖື
======================================================= */
@media (max-width: 768px) {
    /* 1. ປັບ Modal ໃຫ້ເຕັມຈໍຂຶ້ນ */
    #staffHistoryModal .modal-dialog { margin: 10px !important; }
    
    /* 2. ປັບກ່ອງ Summary (ຍອດຂາຍ, ຄ່າຄອມ) ໃຫ້ຮຽງ 2 ຖັນ ປະຢັດເນື້ອທີ່ */
    .summary-cards-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .summary-cards-grid .col-md-3 {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    /* ປັບຟອນໃນກ່ອງໃຫ້ນ້ອຍລົງໜ້ອຍໜຶ່ງ */
    .summary-cards-grid .card-body { padding: 10px !important; }
    .summary-cards-grid .small { font-size: 10px !important; }
    .summary-cards-grid h4 { font-size: 16px !important; }

    /* 3. ປັບສ່ວນເລືອກວັນທີໃຫ້ຮຽງກັນພໍດີ */
    .date-filter-group { flex-wrap: wrap; }
    .date-filter-group input { min-width: 90px; font-size: 12px; }
    .date-filter-group button { width: 100%; margin-top: 10px; border-radius: 6px !important; }

    /* 4. ເຮັດໃຫ້ຕາຕະລາງລຸ່ມເລື່ອນໄດ້ */
    .mobile-table-wrapper {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-table-wrapper table { min-width: 650px; font-size: 12px; }
}

@media (min-width: 769px) {
    .summary-cards-grid { display: flex !important; }
}


/* =======================================================
   🌟 ປັບແຕ່ງໜ້າ ສາງສິນຄ້າ (Inventory) ສຳລັບມືຖື
======================================================= */
@media (max-width: 768px) {
    /* 1. ປັບສ່ວນຫົວ ແລະ ປຸ່ມໃຫ້ຮຽງກັນງາມໆໃນມືຖື */
    .inventory-header { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
    .inventory-header-left { width: 100% !important; justify-content: space-between !important; }
    .inventory-header-right { width: 100% !important; }
    .inventory-header-right button { width: 100% !important; }

    /* 2. ປັບແຖບ Tabs (ສິນຄ້າ, ຄອສ, ປະຫວັດ) ໃຫ້ເລື່ອນໄດ້ຖ້າຈໍແຄບໂພດ */
    #invTabs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    #invTabs .nav-item { flex: 0 0 auto !important; }
    #invTabs .nav-link { padding: 8px 15px !important; font-size: 13px !important; }

    /* 3. ບັງຄັບໃຫ້ຕາຕະລາງທຸກອັນເລື່ອນຊ້າຍ-ຂວາໄດ້ (Horizontal Scroll) */
    .mobile-table-wrapper {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* ກຳນົດຄວາມກວ້າງຂັ້ນຕ່ຳເພື່ອບໍ່ໃຫ້ຕົວໜັງສືຖືກບີບເຂົ້າຫາກັນ */
    #pane-products table, #pane-courses table { min-width: 750px !important; }
    #pane-logs table { min-width: 600px !important; }

    /* 4. ປັບປຸ່ມຈັດການໃນຕາຕະລາງໃຫ້ນ້ອຍລົງ ເພື່ອປະຢັດເນື້ອທີ່ */
    .table-action-btns { display: flex; gap: 4px; justify-content: center; }
    .table-action-btns .btn { padding: 4px 8px !important; font-size: 11px !important; }
}


/* =======================================================
   🌟 ປັບແຕ່ງໜ້າ ຈັດການເງິນເດືອນ (Payroll & Timesheet) ສຳລັບມືຖື
======================================================= */
@media (max-width: 768px) {
    /* 1. ປັບຫົວຂໍ້ ແລະ ປຸ່ມສະຫຼຸບເງິນເດືອນ (Payroll Header) */
    .payroll-header-mobile { flex-direction: column !important; align-items: stretch !important; gap: 15px; }
    .payroll-filter-mobile { flex-direction: column !important; width: 100% !important; }
    .payroll-filter-mobile > div, .payroll-filter-mobile > button { width: 100% !important; border-radius: 8px !important; margin-bottom: 5px; }

    /* 2. ປັບກ່ອງຍອດລວມໃຫ້ຮຽງ 2 ຖັນ */
    .payroll-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .payroll-summary-grid .col-md-4 { width: 100%; padding: 0; margin: 0; }
    .payroll-summary-grid .col-md-4:last-child { grid-column: span 2; } /* ກ່ອງສຸດທ້າຍໃຫ້ເຕັມແຖວ */

    /* 3. ປັບ Footer ປຸ່ມ ຍົກເລີກ/ບັນທຶກ ໃຫ້ແບ່ງເຄິ່ງກັນ (50/50) */
    .modal-footer-mobile { display: flex !important; flex-direction: row !important; gap: 10px; padding-top: 15px; }
    .modal-footer-mobile button { flex: 1; margin: 0 !important; width: 100%; font-size: 14px !important; padding: 10px 5px !important; }

    /* 4. ປັບ Header ຂອງ Timesheet ໃຫ້ປຸ່ມຮຽງກັນພໍດີ */
    .timesheet-header-mobile { flex-direction: column !important; align-items: flex-start !important; gap: 10px; }
    .timesheet-header-mobile .d-flex { width: 100%; justify-content: space-between; }
    .timesheet-header-mobile button { flex: 1; padding: 8px !important; font-size: 12px !important; }

    /* 5. ເຮັດໃຫ້ຕາຕະລາງທຸກອັນເລື່ອນໄດ້ */
    .mobile-table-wrapper { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .mobile-table-wrapper table { min-width: 600px; }
}

/* =======================================================
   🌟 ປັບແຕ່ງໜ້າ ຈຸດຊຳລະເງິນ (POS) ໃຫ້ທັນສະໄໝ
======================================================= */
/* ອະນິເມຊັນເວລາເອົາເມົາສ໌ຊີ້ໃສ່ສິນຄ້າ */
.hover-zoom { transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out; cursor: pointer; }
.hover-zoom:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important; }

/* ປັບແຕ່ງ Scrollbar ໃຫ້ງາມຂຶ້ນ */
.scrollable-grid { overflow-y: auto; overflow-x: hidden; padding-right: 5px; }
.scrollable-grid::-webkit-scrollbar { width: 6px; }
.scrollable-grid::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 10px; }




/* =======================================================
   🌟 ປັບແຕ່ງໜ້າ ຈຸດຊຳລະເງິນ (POS) ສຳລັບມືຖື (FINAL FIX)
======================================================= */
@media (max-width: 991px) {
    /* 1. Header ແລະ Filters ຮຽງແຖວຕັ້ງງາມໆ */
    .pos-header-mobile { flex-direction: column; align-items: stretch !important; gap: 10px; }
    .pos-header-mobile button { width: 100%; }
    .pos-filters { flex-direction: column; }
    .pos-filters .col-md-6 { width: 100%; margin-bottom: 10px; }

    /* 2. 🎯 ແກ້ໄຂ Tab ສິນຄ້າ/ຄອສ ໃຫ້ແບ່ງ 50/50 ແລະ ຢູ່ກາງເປະ */
    #posItemTabs { 
        display: flex !important; 
        width: 100% !important; 
        margin: 0 0 15px 0 !important; 
        padding: 0 !important;
    }
    #posItemTabs .nav-item { 
        flex: 1 1 50% !important; 
        width: 50% !important;
    }
    #posItemTabs .nav-link { 
        width: 100% !important; 
        display: flex !important; 
        justify-content: center !important; 
        align-items: center !important;
        padding: 12px 5px !important; 
        font-size: 14px !important; 
        white-space: nowrap !important; 
    }

    /* ======================================================= */
    /* 🎯 3. ແກ້ໄຂບັນຫາ "ຕົວໜັງສືລຽງແຖວຕັ້ງ" ຂັ້ນເດັດຂາດ! */
    /* ======================================================= */
    
    /* ບັງຄັບໃຫ້ກ່ອງສິນຄ້າ (Product Cards) ທີ່ Render ຈາກ JS ເຕັມພໍດີ */
    #posProductsGrid, #posCoursesGrid {
        display: flex !important;
        flex-wrap: wrap !important;
        margin: 0 -5px !important; /* ລົບຂອບທີ່ເກີນອອກມາ */
    }

    /* ປັບ Class col-6 ທີ່ມາຈາກ JS ໃຫ້ພໍດີກັບໜ້າຈໍມືຖື */
    #posProductsGrid > div, #posCoursesGrid > div {
        flex: 0 0 50% !important; /* ແບ່ງ 2 ຖັນສະເໝີ */
        max-width: 50% !important;
        padding: 0 5px !important; /* ຫຼຸດໄລຍະຫ່າງລະຫວ່າງກ່ອງ */
        margin-bottom: 10px !important;
    }

    /* ຈັດການພື້ນທີ່ທາງໃນກ່ອງ (Card Body) ບໍ່ໃຫ້ບີບຕົວໜັງສື */
    .item-card {
        height: 100% !important;
        width: 100% !important;
    }
    .item-card .card-body {
        padding: 10px 5px !important; /* ຫຼຸດ Padding ທາງໃນລົງເພື່ອເພີ່ມພື້ນທີ່ໃຫ້ຕົວໜັງສື */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* ບັງຄັບໃຫ້ຊື່ສິນຄ້າ (h6) ບໍ່ຕົກແຖວແບບລຽງລົງແຕ່ໃຫ້ຂຶ້ນແຖວໃໝ່ແທນ */
    .item-card h6 {
        font-size: 13px !important; 
        white-space: normal !important; /* ສຳຄັນທີ່ສຸດ: ຍົກເລີກ nowrap ທີ່ອາດຕິດມາຈາກ JS */
        word-wrap: break-word !important; 
        text-align: center !important;
        line-height: 1.3 !important;
        margin-bottom: 5px !important;
        width: 100% !important;
    }

    /* ລາຄາ ແລະ ປ້າຍສະຕັອກ */
    .item-card .text-success {
        font-size: 14px !important; 
        white-space: nowrap !important; /* ລາຄາຫ້າມຕົກແຖວ */
    }
    .item-card .badge {
        font-size: 10px !important; 
        padding: 4px 6px !important;
        white-space: nowrap !important; /* ປ້າຍສະຕັອກຫ້າມຕົກແຖວ */
    }

    /* ບັງຄັບໃຫ້ກ່ອງ "ກະລຸນາເລືອກສາຂາ" ຢູ່ເຄິ່ງກາງ */
    #posProductsGrid .col-12, #posCoursesGrid .col-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        min-height: 200px !important;
    }

    /* ======================================================= */

    /* 4. ແຖບເຣດເງິນ: ເລື່ອນຊ້າຍ-ຂວາໄດ້ ບໍ່ໃຫ້ບີບຕົກແຖວ */
    #posRateContainer {
        display: flex !important; 
        flex-wrap: nowrap !important; 
        overflow-x: auto !important;
        justify-content: flex-start !important; 
        padding: 10px 15px !important; 
        gap: 15px !important; 
        -webkit-overflow-scrolling: touch;
    }
    #posRateContainer span:not(.separator) { white-space: nowrap !important; }
    #posRateContainer .separator { display: none !important; }

    /* 5. ແຍກກ່ອງ Cart ໃຫ້ລົງມາຢູ່ລຸ່ມສຸດ ແລະ ມີຂອບຊັດເຈນ */
    .pos-cart-section { margin-top: 20px; border-top: 4px solid #e2e8f0; padding-top: 20px; }
}
/* =======================================================
   📱 ແກ້ໄຂບັນຫາແຖບອອກລະບົບ (Footer) ຕົກຂອບຂັ້ນເດັດຂາດ! (Ultimate Mobile Fix)
======================================================= */
@media (max-width: 768px) {
    /* 1. ລັອກ Sidebar ໃຫ້ພໍດີກັບຈໍ 100% ແລະ ຫ້າມລົ້ນເດັດຂາດ */
    #sidebar-wrapper {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100dvh !important; /* ສຳລັບບຣາວເຊີລຸ້ນໃໝ່ */
        max-height: 100vh !important; /* ສຳຮອງໄວ້ສຳລັບລຸ້ນເກົ່າ */
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; /* ບັງຄັບຫ້າມ Sidebar ໂດຍລວມເລື່ອນ */
    }

    /* 2. ລັອກໂລໂກ້ດ້ານເທິງ ຫ້າມຫົດຕົວ */
    .sidebar-heading {
        flex-shrink: 0 !important;
    }

    /* 3. ໃຫ້ປັດເລື່ອນ (Scroll) ໄດ້ສະເພາະຊ່ວງກາງທີ່ເປັນເມນູເທົ່ານັ້ນ */
    .sidebar-menu {
        flex: 1 1 auto !important; /* ຂະຫຍາຍເຕັມພື້ນທີ່ຫວ່າງທີ່ເຫຼືອ */
        overflow-y: auto !important; /* ເປີດໃຫ້ປັດຂຶ້ນ-ລົງໄດ້ */
        -webkit-overflow-scrolling: touch !important; /* ໃຫ້ປັດລື່ນໆ ໃນ iPhone */
        padding-bottom: 20px !important;
    }

    /* 4. ບັງຄັບ Footer ໃຫ້ຕິດຢູ່ລຸ່ມສຸດສະເໝີ ບໍ່ວ່າຈໍຈະສັ້ນສ່ຳໃດກໍຕາມ */
    .sidebar-footer {
        flex-shrink: 0 !important; /* ຫ້າມຫົດຕົວເດັດຂາດ */
        position: sticky !important; /* ບັງຄັບຕິດລຸ່ມ */
        bottom: 0 !important;
        width: 100% !important;
        z-index: 99 !important;
        margin-top: 0 !important;
    }
}
