/* Floating Cart Button */
.cart-floating-btn, .orders-floating-btn {
    position: fixed;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 2500;
    user-select: none;
    transition: transform 0.2s;
}
.cart-floating-btn { bottom: 85px; }
.orders-floating-btn { bottom: 25px; background: #28a745; font-size: 20px; }
.cart-floating-btn:hover, .orders-floating-btn:hover { transform: scale(1.08); }

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

/* Modals */
.cm-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.cm-modal-content {
    background: white;
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
.cm-modal-header {
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}
.cm-modal-header h3 { margin: 0; font-size: 17px; }
.cm-modal-close { font-size: 24px; cursor: pointer; color: #888; }
.cm-modal-body { padding: 15px; overflow-y: auto; flex: 1; }
.cm-modal-footer { padding: 12px 18px; border-top: 1px solid #eee; background: #f8f9fa; }

.cm-input {
    width: 100%; padding: 8px 12px; margin: 4px 0 10px 0;
    border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; font-size: 14px;
}
.cm-btn {
    padding: 9px 15px; border-radius: 5px; font-weight: bold; cursor: pointer; border: none; font-size: 14px;
}
.cm-btn-primary { background: #007bff; color: white; }
.cm-btn-success { background: #28a745; color: white; }
.cm-btn-danger { background: #dc3545; color: white; }

.cm-tab-btn {
    flex: 1; padding: 8px; border: 1px solid #ddd; background: #eee; cursor: pointer; border-radius: 5px; font-weight: bold;
}
.cm-tab-btn.active { background: #007bff; color: white; border-color: #007bff; }

/* Cart items list */
.cart-item-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee;
}
.cart-item-img { width: 50px; height: 50px; object-fit: contain; border-radius: 4px; border: 1px solid #ddd; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13.5px; font-weight: 500; }
.cart-item-price { font-size: 13px; color: #28a745; font-weight: bold; }
.cart-item-del { background: none; border: none; font-size: 20px; color: #dc3545; cursor: pointer; }

/* Add to cart buttons */
.btn-add-cart-grid {
    width: 100%; margin-top: 4px; padding: 6px 8px;
    background: #007bff; color: white; border: none; border-radius: 4px;
    font-size: 12.5px; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.btn-add-cart-grid:hover { background: #0056b3; }

.cm-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: white; padding: 10px 20px;
    border-radius: 20px; font-size: 14px; z-index: 4000; display: none;
}

/* Quantity Buttons (+ / -) */
.cm-qty-box {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    height: 28px;
}

.cm-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f8f9fa;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    user-select: none;
}

.cm-qty-btn:hover:not(:disabled) {
    background: #e2e6ea;
    color: #007bff;
}

.cm-qty-val {
    min-width: 30px;
    text-align: center;
    font-size: 13.5px;
    font-weight: bold;
    color: #333;
}

/* ປຸ່ມ + ທີ່ຖືກປິດການໃຊ້ງານເມື່ອສິນຄ້າມີພຽງ 1 ຊິ້ນ */
.cm-qty-btn:disabled,
.cm-qty-disabled {
    background: #f1f1f1 !important;
    color: #bbb !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* =========================================
   TOP USER & CART NAVIGATION BAR (SINGLE ROW)
========================================= */
.cm-top-user-bar {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 0;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 2000;
}

.cm-top-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
    display: flex;
    justify-content: flex-end; /* ຍູ້ປຸ່ມທັງໝົດໄປຢູ່ມຸມຂວາ */
    align-items: center;
}

.cm-top-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap !important; /* 🟢 ຫ້າມບໍ່ໃຫ້ແຕກແຖວເດັດຂາດ */
    overflow-x: auto;              /* 🟢 ຖ້າຈໍມືຖືແຄບຫຼາຍ ສາມາດເລື່ອນຂ້າງໄດ້ ປຸ່ມຈະບໍ່ຕົກແຖວ */
    white-space: nowrap;
    scrollbar-width: none;         /* ເຊື່ອງ scrollbar ຂອງ Firefox */
    -ms-overflow-style: none;      /* ເຊື່ອງ scrollbar ຂອງ IE/Edge */
    padding: 2px 0;
}

.cm-top-bar-right::-webkit-scrollbar {
    display: none;                 /* ເຊື່ອງ scrollbar ຂອງ Chrome/Safari */
}

/* ປັບປຸ່ມໃຫ້ກະທັດຮັດ ພໍດີກັບ 1 ແຖວໃນຈໍມືຖື */
.cm-nav-btn {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    color: #333;
    padding: 4px 9px;              /* ຫຼຸດ padding ລົງ */
    border-radius: 16px;
    font-size: 12px;               /* ຂະໜາດຕົວໜັງສືພໍດີງາມ */
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;                /* ປ້ອງກັນບໍ່ໃຫ້ປຸ່ມຖືກບີບຈົນເສຍຮູບຊົງ */
    transition: all 0.2s ease;
}

.cm-nav-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.cm-nav-cart {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

.cm-nav-cart:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
}

.cm-nav-badge {
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 2px;
}

.cm-nav-auth {
    background: #28a745;
    color: white;
    border-color: #28a745;
    font-weight: bold;
}

.cm-nav-auth:hover {
    background: #218838;
    border-color: #1e7e34;
    color: white;
}

.cm-nav-logout {
    color: #dc3545;
    border-color: #f5c6cb;
    background: #fff;
}

.cm-nav-logout:hover {
    background: #f8d7da;
    border-color: #f5c6cb;
}

/* Modals & Quantity Box */
.cm-qty-box {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    height: 28px;
}

.cm-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f8f9fa;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    user-select: none;
}

.cm-qty-btn:hover:not(:disabled) {
    background: #e2e6ea;
    color: #007bff;
}

.cm-qty-val {
    min-width: 30px;
    text-align: center;
    font-size: 13.5px;
    font-weight: bold;
    color: #333;
}

.cm-qty-btn:disabled,
.cm-qty-disabled {
    background: #f1f1f1 !important;
    color: #bbb !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.cm-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.cm-modal-content {
    background: white;
    width: 92%;
    max-width: 520px;
    max-height: 88vh;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.cm-modal-header {
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cm-modal-header h3 { margin: 0; font-size: 17px; }
.cm-modal-close { font-size: 24px; cursor: pointer; color: #888; }
.cm-modal-body { padding: 15px; overflow-y: auto; flex: 1; }
.cm-modal-footer { padding: 12px 18px; border-top: 1px solid #eee; background: #f8f9fa; }

.cm-input {
    width: 100%; padding: 8px 12px; margin: 4px 0 10px 0;
    border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; font-size: 14px;
}

.cm-btn {
    padding: 9px 15px; border-radius: 5px; font-weight: bold; cursor: pointer; border: none; font-size: 14px;
}

.cm-btn-primary { background: #007bff; color: white; }
.cm-btn-success { background: #28a745; color: white; }
.cm-btn-danger { background: #dc3545; color: white; }

.cm-tab-btn {
    flex: 1; padding: 8px; border: 1px solid #ddd; background: #eee; cursor: pointer; border-radius: 5px; font-weight: bold;
}
.cm-tab-btn.active { background: #007bff; color: white; border-color: #007bff; }

.cart-item-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee;
}
.cart-item-img { width: 50px; height: 50px; object-fit: contain; border-radius: 4px; border: 1px solid #ddd; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 13.5px; font-weight: 500; }
.cart-item-price { font-size: 13px; color: #28a745; font-weight: bold; }
.cart-item-del { background: none; border: none; font-size: 20px; color: #dc3545; cursor: pointer; }

.btn-add-cart-grid {
    width: 100%; margin-top: 4px; padding: 6px 8px;
    background: #007bff; color: white; border: none; border-radius: 4px;
    font-size: 12.5px; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.btn-add-cart-grid:hover { background: #0056b3; }

.cm-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: white; padding: 10px 20px;
    border-radius: 20px; font-size: 14px; z-index: 4000; display: none;
}