:root {
    --nav-height: 70px;
}

body {
    padding-bottom: var(--nav-height);
    background-color: #f8f9fa;
    -webkit-tap-highlight-color: transparent;
}

#page-content {
    min-height: calc(100vh - var(--nav-height));
}

/* Bottom Nav */
#bottom-nav {
    height: var(--nav-height);
    z-index: 1030;
}

.nav-tab {
    text-decoration: none;
    color: #6c757d;
    transition: color 0.2s;
}

.nav-tab.active {
    color: #0d6efd;
}

.nav-tab:hover {
    color: #0d6efd;
}

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

.product-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background: white;
    cursor: pointer;
    transition: box-shadow 0.2s;
    text-align: center;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    -webkit-user-select: none;
    user-select: none;
}

.product-card:active {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.product-card img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.25rem;
    margin: 0 auto 0.25rem;
}

.product-card .product-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-card .product-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #198754;
}

/* Cart */
.cart-section {
    background: white;
    border-top: 2px solid #0d6efd;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item .item-name {
    flex: 1;
    font-size: 0.9rem;
}

.cart-item .item-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item .item-qty button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item .item-total {
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

.cart-summary {
    padding: 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.cart-summary .total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.cart-summary .grand-total {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Category pills */
.category-pills {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.category-pill {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Search bar */
.search-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    padding: 0.5rem;
}

/* Inventory list */
.inventory-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.inventory-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.25rem;
    margin-right: 0.75rem;
}

.inventory-item .item-info {
    flex: 1;
}

.inventory-item .item-info h6 {
    margin-bottom: 0.1rem;
    font-size: 0.95rem;
}

.inventory-item .item-info small {
    color: #6c757d;
}

/* Touch-friendly buttons */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
}

/* PayNow QR */
#paynow-qr canvas,
#paynow-qr img {
    max-width: 250px;
    margin: 0 auto;
}

/* Page header */
.page-header {
    padding: 0.75rem;
    background: white;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Transaction list */
.transaction-item {
    padding: 0.75rem;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.transaction-item:active {
    background: #f8f9fa;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .pos-layout {
        display: grid;
        grid-template-columns: 1fr 350px;
        height: calc(100vh - var(--nav-height));
    }

    .pos-products {
        overflow-y: auto;
    }

    .cart-section {
        border-top: none;
        border-left: 2px solid #0d6efd;
        display: flex;
        flex-direction: column;
    }

    .cart-items {
        flex: 1;
        overflow-y: auto;
    }
}

@media (max-width: 767px) {
    .cart-section {
        position: fixed;
        bottom: var(--nav-height);
        left: 0;
        right: 0;
        max-height: 50vh;
        overflow-y: auto;
        z-index: 1020;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        transform: translateY(calc(100% - 50px));
        transition: transform 0.3s ease;
    }

    .cart-section.expanded {
        transform: translateY(0);
    }

    .cart-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem;
        cursor: pointer;
        background: #0d6efd;
        color: white;
        font-weight: 600;
    }
}

@media (min-width: 768px) {
    .cart-toggle {
        display: none;
    }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
