/* backend/static/css/admin-pos-style.css */

/* --- 浮動全螢幕切換按鈕 --- */
.fullscreen-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background-color: rgba(52, 58, 64, 0.9);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.fullscreen-toggle-btn:hover {
    background-color: rgba(52, 58, 64, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.fullscreen-toggle-btn:active {
    transform: scale(0.95);
}

/* 平板觸控優化 */
@media (max-width: 1024px) {
    .fullscreen-toggle-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
        top: 15px;
        right: 15px;
    }
}

/* 手機版調整 */
@media (max-width: 768px) {
    .fullscreen-toggle-btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
        top: 10px;
        right: 10px;
    }
    
    /* 確保手機版購物車在全螢幕模式下正常運作 */
    body.pos-fullscreen-mode #mobile-pos-cart-bar {
        z-index: 1600;
    }
    
    body.pos-fullscreen-mode .cart-summary-mobile-pos {
        z-index: 1650;
    }
    
    body.pos-fullscreen-mode #cart-backdrop-pos {
        z-index: 1600;
    }
}

/* --- 全螢幕模式樣式 --- */
body.pos-fullscreen-mode {
    overflow: hidden;
}

body.pos-fullscreen-mode .admin-header {
    display: none !important;
}

body.pos-fullscreen-mode footer {
    display: none !important;
}

body.pos-fullscreen-mode #pos-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1500;
    background: #f4f4f4;
    overflow-y: auto;
    padding: 0;
    margin: 0;
}

body.pos-fullscreen-mode #pos-section .container {
    max-width: 100%;
    padding: 20px;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

body.pos-fullscreen-mode #pos-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.8em;
    flex-shrink: 0;
}

body.pos-fullscreen-mode .order-content {
    flex: 1;
    min-height: 0;
    overflow: visible;
    display: flex;
    gap: 30px;
}

body.pos-fullscreen-mode .cart-summary-desktop {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 160px);
    max-height: calc(100vh - 160px);
}

/* 全螢幕模式下的購物車佈局優化 */
body.pos-fullscreen-mode .cart-summary-desktop .cart-items-desktop {
    flex: 0 0 auto;
    max-height: 200px;
    overflow-y: auto;
}

body.pos-fullscreen-mode .cart-summary-desktop .cart-form-wrapper {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

body.pos-fullscreen-mode .cart-summary-desktop .cart-footer {
    flex: 0 0 auto;
    margin-top: auto;
}

/* 確保模態框在全螢幕模式下正常顯示 */
body.pos-fullscreen-mode .pos-modal {
    z-index: 2100 !important;
}

body.pos-fullscreen-mode .modal {
    z-index: 2100 !important;
}

body.pos-fullscreen-mode .modal-backdrop {
    z-index: 2050 !important;
}

/* 確保模態框本身可以接收點擊事件 - 支援兩種class */
body.pos-fullscreen-mode #customItemModal.show,
body.pos-fullscreen-mode #customItemModal.active {
    z-index: 2100 !important;
    pointer-events: auto !important;
}

body.pos-fullscreen-mode #customItemModal.show .modal-dialog,
body.pos-fullscreen-mode #customItemModal.active .modal-dialog {
    z-index: 2101 !important;
    pointer-events: auto !important;
}

/* Bootstrap 模態框特定設置 */
body.pos-fullscreen-mode #customItemModal {
    z-index: 2100 !important;
    pointer-events: auto !important;
}

/* 額外保險措施 - 確保整個modal區域可以互動 */
body.pos-fullscreen-mode #customItemModal * {
    pointer-events: auto !important;
}

/* 防止任何偽元素或覆蓋層阻擋互動 */
body.pos-fullscreen-mode #customItemModal::before,
body.pos-fullscreen-mode #customItemModal::after,
body.pos-fullscreen-mode #customItemModal *::before,
body.pos-fullscreen-mode #customItemModal *::after {
    pointer-events: none !important;
}

body.pos-fullscreen-mode #customItemModal .modal-dialog {
    z-index: 2101 !important;
}

body.pos-fullscreen-mode #customItemModal .modal-content {
    z-index: 2102 !important;
    pointer-events: auto !important;
    position: relative;
}

/* 確保模態框內的表單元素可以互動 */
body.pos-fullscreen-mode .modal-content .form-control {
    z-index: 2103 !important;
    position: relative;
    pointer-events: auto !important;
}

/* 確保 Bootstrap modal 在全螢幕模式下的互動性 - 支援兩種class */
body.pos-fullscreen-mode #customItemModal.show input,
body.pos-fullscreen-mode #customItemModal.active input,
body.pos-fullscreen-mode #customItemModal.show textarea,
body.pos-fullscreen-mode #customItemModal.active textarea,
body.pos-fullscreen-mode #customItemModal.show select,
body.pos-fullscreen-mode #customItemModal.active select,
body.pos-fullscreen-mode #customItemModal input,
body.pos-fullscreen-mode #customItemModal textarea,
body.pos-fullscreen-mode #customItemModal select {
    z-index: 2103 !important;
    position: relative;
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* 確保按鈕和標籤也可以互動 */
body.pos-fullscreen-mode #customItemModal.show button,
body.pos-fullscreen-mode #customItemModal.active button,
body.pos-fullscreen-mode #customItemModal.show label,
body.pos-fullscreen-mode #customItemModal.active label,
body.pos-fullscreen-mode #customItemModal button,
body.pos-fullscreen-mode #customItemModal label {
    z-index: 2103 !important;
    position: relative;
    pointer-events: auto !important;
}

body.pos-fullscreen-mode #customItemModal input:focus,
body.pos-fullscreen-mode #customItemModal textarea:focus,
body.pos-fullscreen-mode #customItemModal select:focus {
    z-index: 2104 !important;
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

body.pos-fullscreen-mode .modal-content input,
body.pos-fullscreen-mode .modal-content textarea,
body.pos-fullscreen-mode .modal-content select,
body.pos-fullscreen-mode .modal-content button,
body.pos-fullscreen-mode .modal-content label {
    z-index: 2103 !important;
    position: relative;
}

/* 確保單選和多選框可以點擊 */
body.pos-fullscreen-mode .modal-content input[type="radio"],
body.pos-fullscreen-mode .modal-content input[type="checkbox"] {
    z-index: 2103 !important;
    position: relative;
}

/* 客製化模態框 */
body.pos-fullscreen-mode #customize-modal {
    z-index: 2100 !important;
}

body.pos-fullscreen-mode #customize-modal .modal-content {
    z-index: 2102 !important;
    position: relative;
}

/* 確保客製化模態框內的表單元素可以互動 */
body.pos-fullscreen-mode #customize-modal .modal-content input,
body.pos-fullscreen-mode #customize-modal .modal-content textarea,
body.pos-fullscreen-mode #customize-modal .modal-content select,
body.pos-fullscreen-mode #customize-modal .modal-content button {
    z-index: 2103 !important;
    position: relative;
}

body.pos-fullscreen-mode #customize-modal .modal-content input:focus,
body.pos-fullscreen-mode #customize-modal .modal-content textarea:focus,
body.pos-fullscreen-mode #customize-modal .modal-content select:focus {
    z-index: 2104 !important;
}

/* 確保客製化模態框內的快速選項和附加選項可以互動 */
body.pos-fullscreen-mode #customize-modal .quick-notes-container,
body.pos-fullscreen-mode #customize-modal .quick-notes-container input,
body.pos-fullscreen-mode #customize-modal .quick-notes-container label,
body.pos-fullscreen-mode #customize-modal .add-ons-grid,
body.pos-fullscreen-mode #customize-modal .add-on-item,
body.pos-fullscreen-mode #customize-modal .add-on-item input,
body.pos-fullscreen-mode #customize-modal .add-on-item label {
    z-index: 2103 !important;
    position: relative;
}

/* QR Code 模態框 */
body.pos-fullscreen-mode #qr-code-modal {
    z-index: 2100 !important;
}

body.pos-fullscreen-mode #qr-code-modal .modal-content {
    z-index: 2102 !important;
}

/* QR Scanner 模態框 */
body.pos-fullscreen-mode #qr-scanner-modal {
    z-index: 2100 !important;
}

body.pos-fullscreen-mode #qr-scanner-modal .modal-content {
    z-index: 2102 !important;
    position: relative;
}

/* 確保QR掃描模態框內的表單元素可以互動 */
body.pos-fullscreen-mode #qr-scanner-modal .modal-content input,
body.pos-fullscreen-mode #qr-scanner-modal .modal-content textarea,
body.pos-fullscreen-mode #qr-scanner-modal .modal-content select,
body.pos-fullscreen-mode #qr-scanner-modal .modal-content button {
    z-index: 2103 !important;
    position: relative;
}

/* 模態框覆蓋層 */
body.pos-fullscreen-mode .modal-overlay {
    z-index: 2100 !important;
}

/* 確保所有模態框內容都可以互動 */
body.pos-fullscreen-mode .pos-modal input,
body.pos-fullscreen-mode .pos-modal textarea,
body.pos-fullscreen-mode .pos-modal select,
body.pos-fullscreen-mode .pos-modal button,
body.pos-fullscreen-mode .pos-modal label {
    z-index: 2103 !important;
    position: relative;
}

/* 特別處理單選和多選框 */
body.pos-fullscreen-mode .pos-modal input[type="radio"],
body.pos-fullscreen-mode .pos-modal input[type="checkbox"] {
    z-index: 2103 !important;
    position: relative;
}

/* 特別處理可能有問題的元素 */
body.pos-fullscreen-mode .modal input:focus,
body.pos-fullscreen-mode .modal textarea:focus,
body.pos-fullscreen-mode .modal select:focus {
    z-index: 2104 !important;
}

/* 全螢幕模式下的按鈕圖示變更 */
body.pos-fullscreen-mode .fullscreen-toggle-btn .fullscreen-icon::before {
    content: "⛶";
}

body:not(.pos-fullscreen-mode) .fullscreen-toggle-btn .fullscreen-icon::before {
    content: "↙";
}

/* --- 全局調整 --- */
#pos-section .container {
    max-width: 98%;
    width: 100%;
}

/* --- 主體佈局 (桌面版) --- */
#pos-section .order-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: start;
}

#pos-section .menu-selection {
    grid-column: 1 / 2;
}

#pos-section .cart-summary-desktop {
    grid-column: 2 / 3;
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px); 
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- 分頁樣式 --- */
.pos-tabs {
    display: flex;
    border-bottom: 2px solid #ccc;
    margin-bottom: 20px;
}
.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1.2em;
    font-weight: bold;
    color: #888;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}
.tab-link:hover, .tab-link.active { color: #0ABAB5; }
.tab-link.active { border-bottom-color: #0ABAB5; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- 菜單卡片樣式 --- */
#pos-section .order-menu-item .order-item-content {
    justify-content: center;
    text-align: center;
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
}
#pos-section .order-menu-item h4 {
    font-size: 1.1em;
    margin-bottom: 10px;
    flex-grow: 1;
}
#pos-section .order-menu-item .order-item-footer {
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

/* --- 可點擊菜單項目樣式 --- */
#pos-section .order-menu-item.clickable-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

#pos-section .order-menu-item.clickable-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #0ABAB5;
}

#pos-section .order-menu-item.clickable-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- 禁用菜單項目樣式 --- */
#pos-section .order-menu-item.disabled-item {
    cursor: not-allowed;
    opacity: 0.6;
    background-color: #f8f8f8;
}

#pos-section .order-menu-item.disabled-item .order-item-content {
    color: #999;
}

#pos-section .order-menu-item.disabled-item .order-item-price {
    color: #bbb;
}

/* --- 價格樣式調整 --- */
#pos-section .order-menu-item .order-item-price {
    font-size: 1.2em;
    font-weight: bold;
    color: #0ABAB5;
    text-align: center;
}

/* --- POS 桌面版購物車樣式 --- */
#pos-section .cart-summary-desktop h3 {
    color: #0ABAB5;
    margin: 0 0 15px 0;
    font-size: 1.8em;
    text-align: center;
    flex-shrink: 0;
}
#pos-section .cart-items-desktop {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
    overflow-y: auto;
    min-height: 180px;
    flex-shrink: 1;
    flex-grow: 1;
}
#pos-section .cart-form-wrapper {
    overflow-y: auto;
    padding-right: 5px;
    margin-right: -5px;
    flex-shrink: 1; /* 允許收縮 */
    flex-grow: 1;
}
#pos-section .form-group {
    margin-top: 10px;
    text-align: left;
}
#pos-section .form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    display: block;
    font-size: 0.95em;
}
#pos-section .payment-options {
    display: flex; /* 改為 flex 佈局，使其水平排列 */
    flex-wrap: wrap; /* 允許換行 */
    gap: 20px; /* 選項之間的間距 */
    align-items: center; /* 垂直置中 */
}

#pos-section .payment-option {
    display: flex;
    align-items: center;
    background: none; /* 移除背景 */
    border: none; /* 移除邊框 */
    padding: 2px 0; /* 減少垂直內邊距 */
    cursor: pointer;
    font-size: 1em; /* 稍微調整字體大小，使其更清晰 */
}

/* 讓 radio 按鈕和文字之間有點間距 */
#pos-section .payment-option input[type="radio"] {
    margin-right: 6px;
}

/* 當 radio 被選中時，對應的文字樣式 */
#pos-section .payment-option input[type="radio"]:checked + span {
    color: #0ABAB5;
    font-weight: bold;
}

#pos-section #notes {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 12px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    min-height: 50px; /* 縮短備註欄高度 */
}
#pos-section #notes:focus {
    outline: none;
    border-color: #0ABAB5;
    box-shadow: 0 0 0 3px rgba(10, 171, 181, 0.25);
}
#pos-section .cart-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 2px solid #eee;
    flex-shrink: 0;
}
#submit-pos-order-btn {
    width: 100%;
    padding: 12px;
}

/* --- 會員搜尋框 --- */
.member-search-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.member-search-input-group input {
    flex-grow: 1;
    margin: 0;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}
.member-search-input-group button {
    height: 40px;
    flex-shrink: 0;
    margin: 0;
    padding: 0 15px;
}
#member-info-display, #member-info-display-mobile {
    margin-top: 8px;
    font-size: 0.9em;
}

/* --- POS 客製化彈窗 (單品加點) --- */
#customize-modal.pos-modal {
    display: none;
    position: fixed;
    z-index: 1040;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    padding: 20px 10px;
    box-sizing: border-box;
    overflow: hidden;
}

#customize-modal.pos-modal.active {
    display: flex;
}

#customize-modal .close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}
#customize-modal .close-btn:hover {
    color: #333;
}

.pos-modal .modal-content {
    background-color: #fefefe;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    padding: 0;
}

.pos-modal .modal-content > h3,
.pos-modal .modal-body,
.pos-modal .modal-footer {
    padding-left: 30px;
    padding-right: 30px;
}

.pos-modal .modal-content > h3 {
    flex-shrink: 0;
    margin: 0;
    padding-top: 25px;
    padding-bottom: 15px;
    font-size: 1.8em;
    color: #0ABAB5;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.pos-modal .modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-top: 20px;
    padding-bottom: 20px;
}

.pos-modal .modal-body h4 {
    font-size: 1.2em;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

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

.pos-modal .modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.pos-modal .modal-body input[type="number"],
.pos-modal .modal-body textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

.pos-modal .modal-body textarea {
    min-height: 80px;
}

.pos-modal .add-ons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
}

.pos-modal .add-ons-grid .add-on-item {
    display: flex;
    align-items: center;
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 5px;
}

.pos-modal .quick-notes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.pos-modal .quick-note-btn {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    color: #495057;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pos-modal .quick-note-btn:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
}

.pos-modal .modal-footer {
    flex-shrink: 0;
    padding-top: 20px;
    padding-bottom: 25px;
    text-align: right;
    border-top: 1px solid #eee;
}

.pos-modal .modal-footer .btn {
    padding: 10px 25px;
}

/* ======================================================= */
/* == 手機版響應式樣式 (核心修改) == */
/* ======================================================= */

/* 預設隱藏手機版元件 */
#mobile-pos-cart-bar, .cart-summary-mobile-pos, #cart-backdrop-pos {
    display: none !important;
}

@media (max-width: 992px) {
    #pos-section .order-content {
        display: flex;
        flex-direction: column;
    }
    
    .cart-summary-desktop,
    .cart-summary-desktop .form-group,
    .cart-summary-desktop .member-search-input-group,
    .cart-summary-desktop #notes,
    .cart-summary-desktop .cart-footer,
    .cart-summary-desktop #submit-pos-order-btn {
        display: none;
    }

    #mobile-pos-cart-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #f8f9fa;
        color: #343a40;
        padding: 10px 20px;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        border-top: 1px solid #dee2e6;
        z-index: 1001;
        box-sizing: border-box;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }
    #mobile-pos-cart-bar .cart-info-summary {
        display: flex;
        flex-direction: column;
        text-align: left;
    }
    #mobile-pos-cart-bar #mobile-pos-cart-breakdown {
        font-size: 0.9em;
        color: #6c757d;
    }
    #mobile-pos-cart-bar #mobile-pos-cart-total {
        font-size: 1.2em;
        font-weight: bold;
    }
    #mobile-pos-cart-bar .cart-action {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 1.1em;
        font-weight: bold;
        color: #0ABAB5;
    }

    #cart-backdrop-pos {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1002;
        transition: opacity 0.4s ease;
        opacity: 0;
        pointer-events: none;
    }
    #cart-backdrop-pos.is-visible {
        display: block !important;
        opacity: 1;
        pointer-events: auto;
    }

    .cart-summary-mobile-pos {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        background-color: #fff;
        z-index: 1003;
        padding: 20px;
        box-sizing: border-box;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        transform: translateY(100%);
        transition: transform 0.4s ease-in-out;
    }
    .cart-summary-mobile-pos.is-open {
        transform: translateY(0);
    }
    .cart-summary-mobile-pos .cart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
        flex-shrink: 0;
    }
    .cart-summary-mobile-pos .cart-header h4 {
        margin: 0;
        font-size: 1.2em;
        color: #333;
    }
    .cart-summary-mobile-pos .close-cart-btn-pos {
        font-size: 28px;
        font-weight: bold;
        color: #aaa;
        background: none;
        border: none;
        cursor: pointer;
    }
    .cart-summary-mobile-pos .cart-items-mobile-pos {
       flex-grow: 1;
       overflow-y: auto;
       min-height: 100px;
    }
    .cart-summary-mobile-pos .cart-form-wrapper-mobile {
        max-height: 250px;
        overflow-y: auto;
        padding: 10px;
        margin-bottom: 15px;
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
    }
     .cart-summary-mobile-pos #submit-pos-order-btn-mobile {
        width: 100%;
        margin-top: 15px;
        font-size: 1.2em;
    }
}

/* ======================================================= */
/* == QR Code Modal == */
/* ======================================================= */
#qr-code-modal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1050;
}
#qr-code-modal.modal-overlay.active {
    display: flex;
}
#qr-code-modal .modal-content {
    background-color: #ffffff;
    padding: 20px 30px 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 380px;
    position: relative;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
#qr-code-modal.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}
#qr-code-modal .modal-content .close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaaaaa;
    transition: color 0.2s;
}
#qr-code-modal .modal-content .close-btn:hover {
    color: #333333;
}
#qr-code-modal #qr-code-container {
    margin: 15px 0;
}
#qr-code-modal #qr-code-image {
    width: 256px;
    height: 256px;
    border: 1px solid #dddddd;
    border-radius: 8px;
}
#qr-code-modal #qr-code-message {
    font-size: 1.1em;
    color: #333333;
    font-weight: 500;
    min-height: 24px;
}

/* 針對 #addCustomItemBtn 的樣式 */
#addCustomItemBtn {
    padding: 10px 20px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background-color: #0ABAB5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#addCustomItemBtn:hover {
    background-color: #089da3;
    transform: translateY(-2px);
}

#addCustomItemBtn:active {
    transform: translateY(0);
}

.disabled-btn {
    background-color: #ccc !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.6;
}
.disabled-input {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- 客製化餐點 Modal (手動新增) --- */
#customItemModal.pos-modal {
    display: none;
    position: fixed;
    z-index: 1040;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

#customItemModal.pos-modal.active {
    display: flex;
}

#customItemModal .modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.3s ease-out;
}

#customItemModal .modal-header,
#customItemModal .modal-body,
#customItemModal .modal-footer {
    padding: 0;
}

#customItemModal .modal-header .close,
#customItemModal .modal-header .btn-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: #aaa;
    opacity: 1;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 2103 !important;
    pointer-events: auto !important;
}

#customItemModal .modal-header .close:hover,
#customItemModal .modal-header .btn-close:hover {
    color: #333;
    opacity: 0.75;
}

/* Bootstrap 5 btn-close 特定樣式 */
#customItemModal .modal-header .btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23aaa'%3e%3cpath d='m.235 1.807 1.572-1.572L8 6.428l6.193-6.193 1.572 1.572L9.572 8l6.193 6.193-1.572 1.572L8 9.572l-6.193 6.193-1.572-1.572L6.428 8 .235 1.807z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    width: 1em;
    height: 1em;
    font-size: 1em;
}

/* 確保關閉按鈕在全螢幕模式下可互動 */
body.pos-fullscreen-mode #customItemModal .modal-header .close,
body.pos-fullscreen-mode #customItemModal .modal-header .btn-close {
    z-index: 2103 !important;
    position: relative;
    pointer-events: auto !important;
}

#customItemModal .modal-header h5 {
    margin: 0;
    font-size: 1.8em;
    color: #0ABAB5;
    text-align: center;
    font-weight: 600;
}

#customItemModal .modal-body .form-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

#customItemModal .modal-body label {
    flex: 0 0 120px;
    margin: 0;
    color: #495057;
    font-weight: 600;
    font-size: 1em;
    text-align: right;
}

#customItemModal .modal-body input[type="text"],
#customItemModal .modal-body input[type="number"] {
    flex: 1;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#customItemModal .modal-body input[type="text"]:focus,
#customItemModal .modal-body input[type="number"]:focus {
    outline: none;
    border-color: #0ABAB5;
    box-shadow: 0 0 0 3px rgba(10, 171, 181, 0.25);
}

#customItemModal .modal-footer {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

#customItemModal .modal-footer .btn {
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#customItemModal .modal-footer .btn-primary {
    background-color: #0ABAB5;
    color: #fff;
}

#customItemModal .modal-footer .btn-primary:hover {
    background-color: #089da3;
    transform: translateY(-2px);
}

#customItemModal .modal-footer .btn-secondary {
    background-color: #fff;
    color: #495057;
    border: 1px solid #ced4da;
}

#customItemModal .modal-footer .btn-secondary:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

#customItemModal .modal-footer #saveCustomItemBtn {
    padding: 12px 30px;
    font-size: 1em;
    background-color: #0ABAB5;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

#customItemModal .modal-footer #saveCustomItemBtn:hover {
    background-color: #089da3;
    transform: translateY(-2px);
}

#customItemModal .modal-footer #saveCustomItemBtn:active {
    transform: translateY(0);
}

#customItemModal .modal-footer #saveCustomItemBtn:disabled,
#customItemModal .modal-footer #saveCustomItemBtn.disabled-btn {
    background-color: #8ac6c5;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- 【新增】手機版客製化項目彈窗響應式調整 --- */
@media (max-width: 767px) {
    #customItemModal .modal-content {
        padding: 20px; /* 在手機上減少內邊距 */
    }

    #customItemModal .modal-body .form-group {
        flex-direction: column; /* 將 label 和 input 垂直堆疊 */
        align-items: flex-start; /* 左對齊 */
        gap: 8px; /* 減少堆疊時的間距 */
    }

    #customItemModal .modal-body label {
        flex: none; /* 移除固定的寬度 */
        width: 100%; /* 佔滿整行 */
        text-align: left; /* 文字靠左對齊 */
        margin-bottom: 0;
    }

    #customItemModal .modal-footer {
        flex-direction: column; /* 讓按鈕也垂直堆疊 */
        gap: 10px;
    }

    #customItemModal .modal-footer .btn {
        width: 100%; /* 讓按鈕佔滿寬度 */
        box-sizing: border-box; /* 確保 padding 不會影響寬度 */
    }
}

/* ======================================================= */
/* == 找零計算器樣式 == */
/* ======================================================= */
.change-calculator {
    background-color: #f0f8ff;
    border: 2px solid #0ABAB5;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    font-family: 'Arial', sans-serif;
}

.change-calculator h4 {
    color: #0ABAB5;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 1.5em;
    font-weight: bold;
}

.calculator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-size: 1.2em;
}

.calculator-label {
    font-weight: bold;
    color: #333;
    min-width: 100px;
}

.calculator-total {
    font-size: 1.4em;
    font-weight: bold;
    color: #0ABAB5;
    background-color: white;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #0ABAB5;
}

.calculator-input {
    flex: 1;
    padding: 12px;
    font-size: 1.2em;
    border: 2px solid #ccc;
    border-radius: 6px;
    background-color: white;
    transition: border-color 0.2s;
    max-width: 200px;
    margin-left: 10px;
}

.calculator-input:focus {
    outline: none;
    border-color: #0ABAB5;
    box-shadow: 0 0 0 3px rgba(10, 171, 181, 0.25);
}

.quick-amount-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
}

.quick-amount-btn, .clear-amount-btn {
    padding: 10px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: 2px solid #0ABAB5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.quick-amount-btn {
    background-color: white;
    color: #0ABAB5;
}

.quick-amount-btn:hover {
    background-color: #0ABAB5;
    color: white;
    transform: translateY(-2px);
}

.clear-amount-btn {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.clear-amount-btn:hover {
    background-color: #c82333;
    border-color: #c82333;
    transform: translateY(-2px);
}

.change-display {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #28a745;
    margin-top: 20px;
}

.calculator-change {
    font-size: 2em;
    font-weight: bold;
    color: #28a745;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* 當找零為負數時的樣式 */
.calculator-change.insufficient {
    color: #dc3545;
}

/* 手機版調整 */
@media (max-width: 992px) {
    .change-calculator {
        padding: 15px;
    }
    
    .calculator-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .calculator-input {
        width: 100%;
        max-width: none;
        margin-left: 0;
    }
    
    .quick-amount-buttons {
        gap: 8px;
    }
    
    .quick-amount-btn, .clear-amount-btn {
        flex: 1;
        min-width: 70px;
        font-size: 1em;
        padding: 8px 15px;
    }
    
    .calculator-change {
        font-size: 1.8em;
    }
}