/* Basic Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f8;
    margin: 0;
    padding: 20px;
    color: #333;
    touch-action: manipulation;
}

h1, h2 {
    color: #1a2533;
}

.no-disp {
  display: none;
}

/* Main Layout - DESKTOP FIRST */
.pos-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: auto;
    height: calc(100vh - 40px); /* Fixed height for desktop layout */
}

.products-pane {
    flex: 3; /* Takes up 3/4 of the space */
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.receipt-pane {
    flex: 1; /* Takes up 1/4 of the space */
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding: 10px;
}

.product-btn {
    padding: 20px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
}

.product-btn:hover {
    background-color: #e0f7fa;
    border-color: #007bff;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.product-btn:first-child {
    background-color: #fae0e0;
    border-color: #ff0000;
}

.product-price {
    display: block;
    font-size: 0.8rem;
    color: #555;
    margin-top: 5px;
}

/* Receipt Styling */
.receipt-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 10px;
}

.empty-cart-message {
    color: #888;
    text-align: center;
    margin-top: 50px;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px dotted #ccc;
    font-size: 0.95rem;
}

.receipt-item:last-child {
    border-bottom: none;
}

.name-pane {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px dotted #ccc;
    font-size: 0.95rem;
}

.item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.item-name {
    font-weight: 500;
}

.item-price-per-unit {
    font-size: 0.8em;
    color: #777;
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-quantity-input {
    width: 50px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px;
    font-size: 1rem;
}
/* .item-quantity-input::-webkit-outer-spin-button,
.item-quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.item-quantity-input[type=number] {
  -moz-appearance: textfield;
}
*/
.name-input {
    display: block;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px;
    font-size: 1rem;
}

.item-total-price {
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.remove-item-btn:hover {
    color: #a0202d;
}

.receipt-summary {
    border-top: 1px solid #eee;
    margin-top: 10px;
    padding-top: 10px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.95rem;
}

.summary-line.bonus {
    color: #28a745;
}

.receipt-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px 0 0 0;
    border-top: 2px solid #333;
    margin-top: 10px;
}

.receipt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.action-btn {
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.action-btn.pay {
    background-color: #28a745;
    color: white;
}
.action-btn.pay:hover {
    background-color: #218838;
}

.action-btn.clear {
    background-color: #dc3545;
    color: white;
}
.action-btn.clear:hover {
    background-color: #c82333;
}


/* =================================================== */
/* ============== RESPONSIVE STYLES ================== */
/* =================================================== */

/* Apply these styles on screens 768px wide or smaller */
@media (max-width: 768px) {
    body {
        padding: 10px; /* Reduce padding on small screens */
    }

    .pos-container {
        /* Change flex direction to stack panes vertically */
        flex-direction: column; 
        /* Allow height to be determined by content */
        height: auto; 
        gap: 10px;
    }

    .products-pane {
        /* Remove the flex-grow property, let it take its natural height */
        flex: none; 
        height: 70vh; /* Give product pane a fixed portion of the screen */
    }

    .receipt-pane {
        /* Remove the flex-grow property */
        flex: none;
        /* Ensure the receipt pane can grow but not shrink too much */
        height: 80vh; 
        min-height: 40vh;
    }

    .receipt-items-container {
        /* On mobile, it's better to give the item list a max height */
        /* so the total and pay buttons are always visible. */
        max-height: 200px;
    }

    .product-grid {
        /* Adjust grid for smaller buttons on mobile */
        gap: 10px;
        grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
    }

    .product-btn {
        padding: 15px 8px;
        font-size: 0.9rem;
    }
}
