/* 基本重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans TC', sans-serif;
}

body {
    background-color: #333333;
    /* 原 Tkinter bg="#333333" */
    color: #fff;
    height: 100vh;
    overflow: hidden;
    /* 防止整個網頁出現卷軸，各區塊獨立滾動 */
}

/* 佈局容器 */
.pos-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 左側：購物車面板 */
.left-panel {
    width: 400px;
    /* 固定寬度 */
    background-color: #222;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #444;
}

.cart-header {
    padding: 15px;
    background-color: #111;
    text-align: center;
    border-bottom: 2px solid #555;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.cart-table th {
    color: #aaa;
    font-size: 0.9rem;
}

.cart-table td {
    font-size: 1.1rem;
}

.cart-table .btn-remove {
    background: none;
    border: none;
    color: #D32F2F;
    /* self.color_nice_red */
    cursor: pointer;
    font-size: 1.2rem;
}

.cart-footer {
    padding: 15px;
    background-color: #1a1a1a;
    border-top: 2px solid #555;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
}

.payment-row #lbl-change {
    color: #fff;
    /* 預設白，足夠時會變綠 */
}

.input-display {
    background-color: #000;
    color: #FF8C00;
    padding: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 5px;
    letter-spacing: 2px;
}

.btn-checkout {
    background-color: gray;
    /* 預設 disabled */
    color: white;
    font-size: 1.5rem;
    padding: 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: not-allowed;
    transition: background-color 0.3s;
}

.btn-checkout:not(:disabled) {
    background-color: #D32F2F;
    /* self.color_nice_red */
    cursor: pointer;
}

/* 右側：商品與功能面板 */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

/* 功能列 */
.function-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.page-label {
    font-size: 1.5rem;
    font-weight: bold;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn-manage,
.btn-home {
    background-color: #6A1B9A;
    /* self.color_purple */
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-home {
    background-color: #555;
}

.btn-manage:hover,
.btn-home:hover {
    filter: brightness(1.2);
}

/* 數字鍵盤區 */
.numpad-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 8px;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 300px;
}

.num-btn {
    background-color: #444;
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.num-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-clear {
    background-color: #D32F2F;
    grid-column: span 2;
}

.numpad-info {
    flex: 1;
    color: #bbb;
    font-size: 1rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.numpad-info ul {
    margin-top: 10px;
    padding-left: 20px;
}

/* 商品方塊網路 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    flex: 1;
}

.product-btn {
    background-color: white;
    color: #FF8C00;
    /* self.color_orange */
    border: 8px solid #ddd;
    border-radius: 10px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    font-family: 'Microsoft JhengHei', sans-serif;
    transition: transform 0.1s;
}

.product-btn:active {
    transform: scale(0.98);
}

.product-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.product-price {
    font-size: 1.3rem;
    color: #333;
}

.product-stock {
    font-size: 1rem;
    color: #666;
}

/* 共通按鈕重置 */
.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

/* Modal 樣式 */
.modal {
    display: none;
    /* 預設隱藏 */
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #333;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    color: white;
}

.modal-center {
    width: 500px;
    text-align: center;
    padding: 30px;
    background-color: white;
    color: #333;
}

.modal-center .modal-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.modal-center .checkout-details {
    font-size: 1.5rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

.modal-center .change-title {
    font-size: 1.5rem;
    color: #555;
}

.modal-center .change-amount {
    font-size: 4.5rem;
    font-weight: bold;
    color: #D32F2F;
    margin: 10px 0 30px 0;
}

.btn-confirm {
    background-color: #FF8C00;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px;
    width: 100%;
    border-radius: 5px;
}

/* 品項管理 Modal */
.manage-content {
    width: 900px;
    height: 650px;
    display: flex;
    flex-direction: column;
}

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #222;
    border-bottom: 1px solid #444;
}

.btn-close {
    background: none;
    color: #fff;
    font-size: 1.5rem;
}

.manage-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.manage-left {
    flex: 2;
    padding: 20px;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
}

.manage-left h3 {
    margin-bottom: 15px;
}

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    background-color: #444;
    border-radius: 5px;
}

.manage-table {
    width: 100%;
    border-collapse: collapse;
}

.manage-table th,
.manage-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #555;
    cursor: pointer;
}

.manage-table tr.selected {
    background-color: #555;
}

.manage-table th {
    background-color: #333;
    position: sticky;
    top: 0;
}

.manage-right {
    flex: 1;
    padding: 30px;
    background-color: #E1BEE7;
    /* self.color_light_purple */
    color: #6A1B9A;
    /* self.color_purple */
    display: flex;
    flex-direction: column;
}

.settings-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
}

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

.form-group label {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    font-size: 1.2rem;
    background-color: black;
    color: white;
    border: 1px solid #333;
    border-radius: 5px;
}

.btn-add-product,
.btn-delete-product {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    color: white;
    border-radius: 5px;
    width: 100%;
    margin-top: 10px;
}

.btn-add-product {
    background-color: #6A1B9A;
}

.divider {
    height: 1px;
    background-color: #BA68C8;
    margin: 30px 0;
}



.delete-hint {
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.btn-delete-product {
    background-color: #D32F2F;
}

/* 響應式：平板與手機 */
@media (max-width: 900px) {
    body {
        height: auto;
        overflow: auto;
        /* 允許手機端網頁原生滾動，解決高度重疊 */
    }

    .pos-container {
        flex-direction: column;
        height: auto;
    }

    .left-panel {
        width: 100%;
        height: auto;
        /* 取消高度 40vh，改為自動撐開，讓結帳按鈕完全顯示 */
        border-right: none;
        border-bottom: 4px solid #111;
    }

    .cart-body {
        min-height: 15vw;
        max-height: 30vh;
        /* 避免購物車佔用過多畫面 */
    }

    .right-panel {
        height: auto;
        overflow: visible;
    }

    /* 將功能列（品項管理、回首頁）移到最下方，避免擋住結帳 */
    .function-bar {
        order: 3;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .numpad-info {
        display: none;
        /* 小螢幕隱藏提示以節省空間 */
    }

    .numpad {
        width: 100%;
    }

    .manage-content {
        width: 95vw;
        height: 90vh;
        flex-direction: column;
    }

    .manage-left,
    .manage-right {
        flex: 1;
    }
}