:root {
    --pos-green: #006400;
    --pos-green-dark: #004d00;
    --pos-bg: #f8fafc;
    --pos-card-bg: #ffffff;
    --pos-text: #1e293b;
    --pos-border: #e2e8f0;
    --pos-danger: #ef4444;
    --pos-primary: #006400;
    --pos-secondary: #3b82f6;
    --pos-accent: #f59e0b;
    --pos-ongoing: #dc2626;
    --pos-surface: rgba(255, 255, 255, 0.8);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #121111 !important; /* Deep dark to match iPhone home bar area */
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    color: var(--pos-text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    background-color: #121111 !important;
}

h1, h2, h3, h4, h5, h6, .fw-bold, .fw-black, .fw-900, .fw-800 {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Header Section */
.pos-header {
    background-color: var(--pos-green);
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
}

.grand-total-bar {
    padding: 10px 15px 5px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-search-container {
    padding: 10px;
    background-color: white;
    display: flex;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--pos-border);
}

.pos-search-input {
    flex: 1;
    border: 1px solid var(--pos-border);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    background: #fdfdfd;
}

.btn-add-item {
    background-color: white;
    border: 2px solid var(--pos-green);
    color: var(--pos-green);
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
}

/* Cart / Selected Items Section */
.pos-cart-section {
    flex-shrink: 1;
    max-height: 25vh;
    overflow-y: auto;
    background: white;
    border-bottom: 2px solid #f1f5f9;
    box-shadow: inset 0 -10px 20px -10px rgba(0,0,0,0.05);
}

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

.pos-table th {
    background: var(--pos-green);
    color: white;
    text-align: left;
    padding: 8px;
    font-size: 12px;
}

.pos-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.item-name-cell {
    font-weight: 600;
    font-size: 13px;
    max-width: 120px;
}

.item-variant {
    font-size: 11px;
    color: #888;
    display: block;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f8f8;
    border-radius: 6px;
    padding: 4px;
}

.btn-qty {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.qty-val {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.btn-delete {
    color: var(--pos-danger);
    cursor: pointer;
    font-size: 16px;
}

/* Action Buttons Grid */
.pos-actions-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px;
    background: white;
}

.btn-action {
    padding: 8px;
    border-radius: 6px;
    border: none;
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.btn-online { background-color: var(--pos-green); }
.btn-ongoing { background-color: var(--pos-ongoing); }
.btn-qrcode { background-color: var(--pos-secondary); }
.btn-more { background-color: #d35400; }

/* Category Scroll */
.pos-categories {
    display: flex;
    overflow-x: auto;
    padding: 10px;
    gap: 10px;
    background: white;
    border-top: 1px solid #eee;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.pos-categories::-webkit-scrollbar {
    display: none;
}

.category-tab {
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid var(--pos-border);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    background: white;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.category-tab.active {
    background: linear-gradient(135deg, var(--pos-green) 0%, var(--pos-green-dark) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0,100,0,0.2);
    transform: translateY(-1px);
}

.pos-products-grid {
    flex: 1;
    overflow-y: auto;
    background: white;
    width: 100%;
    padding-bottom: 200px; /* Generous space for fixed footer and overscroll */
}

.product-list-item:active {
    background-color: #e9ecef !important;
}

.product-list-img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    background: #f8fafc;
    border: 1px solid #eee;
}

.product-list-info {
    flex: 1;
}

.product-list-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    display: block;
    margin-bottom: 2px;
}

.product-list-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--pos-green);
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.product-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #eee;
}

.product-info {
    padding: 8px;
}

.product-title {
    font-size: 11px;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
    height: 2.4em;
    overflow: hidden;
    line-height: 1.2;
}

.product-variant {
    font-size: 9px;
    color: #888;
}

.product-price {
    font-size: 12px;
    font-weight: 800;
    color: var(--pos-green);
    display: block;
    margin-top: 4px;
}

/* Footer Section */
.pos-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 0; 
    margin-bottom: 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    background: #121111; /* Deep dark to eliminate bottom color gap */
}

.grand-total-bar {
    background: linear-gradient(90deg, var(--pos-green) 0%, var(--pos-green-dark) 100%);
    color: white;
    padding: 14px;
    text-align: center;
    font-weight: 900;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.bottom-actions {
    display: flex;
    padding: 8px 10px 8px 10px; /* Reduced padding and added bottom padding for touch comfort */
    gap: 6px; /* Tighter gap between buttons */
    background: #1e1e1e;
}

.btn-bottom-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.1s active;
}

.btn-calc { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); }
.btn-clear { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2); }

.btn-bottom-main {
    flex: 1;
    height: 52px;
    border-radius: 14px;
    border: none;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-quick-order {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-place-order {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
}

/* Responsive fixes */
@media (max-width: 400px) {
    .pos-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
