/* ==========================================
   ARA Coffee - POS Page Styles
   Mobile-First - Cart Always Visible
   ========================================== */

/* === POS Main Layout === */
.pos-main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 90px);
    overflow: hidden;
}

/* ==========================================
   PRODUCTS SECTION
   ========================================== */
.products-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.category-tabs-container {
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) transparent;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.category-tabs-container::-webkit-scrollbar {
    height: 4px;
}

.category-tabs-container::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 2px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
}

.category-tab {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    flex-shrink: 0;
}

.category-tab:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}

.category-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding: 8px;
    flex: 1;
    align-content: start;
}

.product-card {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

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

.product-card.product-inactive {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-image {
    width: 100%;
    height: 100px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
}

.product-info {
    padding: 12px;
}

.product-info h3 {
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

.price {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1rem;
}

.inactive-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--color-error);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* ==========================================
   CART SECTION
   ========================================== */
.cart-section {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--glass-border);
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.3rem;
    color: var(--color-primary);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    min-height: 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
    gap: 12px;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.item-price {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 2px;
}

.item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 2px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    background: var(--color-primary);
    color: white;
}

.qty-value {
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    color: var(--text-primary);
}

.delete-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.delete-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.item-total {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 0.95rem;
    min-width: 80px;
    text-align: left;
    flex-shrink: 0;
}

.empty-cart {
    text-align: center;
    color: var(--text-light);
    padding: 48px 0;
    font-size: 0.95rem;
}

/* Cart Footer */
.cart-footer {
    border-top: 2px solid var(--glass-border);
    padding-top: 16px;
    flex-shrink: 0;
}

.cart-summary {
    margin-bottom: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-row.total-row {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-primary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid var(--glass-border);
}

/* Discount Section */
.discount-section {
    margin: 12px 0;
    padding: 10px;
    background: rgba(231, 76, 60, 0.05);
    border-radius: 8px;
    border: 1px dashed #e74c3c;
}

.discount-section input {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.btn-sm {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    color: #fff;
    white-space: nowrap;
}

/* Payment Methods */
.payment-methods {
    display: flex;
    gap: 16px;
    margin: 16px 0;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    padding: 8px 16px;
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.radio-label:hover {
    border-color: var(--color-primary);
}

.radio-label:has(input:checked) {
    border-color: var(--color-primary);
    background: rgba(139, 69, 19, 0.05);
}

/* Checkout Button */
#checkout-btn {
    font-size: 1rem;
    font-weight: 700;
    padding: 14px;
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */
@media (max-width: 1024px) {
    .pos-main {
        grid-template-columns: 1fr;
        height: auto;
        padding: 12px;
        gap: 12px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        max-height: none;
    }
    
    .cart-section {
        position: sticky;
        bottom: 0;
        max-height: 50vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        z-index: 50;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
    
    .cart-items {
        max-height: 150px;
    }
}

/* ==========================================
   RESPONSIVE - MOBILE (max 768px)
   ========================================== */
@media (max-width: 768px) {
    .pos-main {
        display: flex;
        flex-direction: column;
        padding: 8px;
        gap: 0;
        height: 100vh;
        overflow: hidden;
    }

    /* HEADER */
    .app-header {
        padding: 8px 12px;
        flex-shrink: 0;
    }
    
    .header-center {
        order: 3;
        width: 100%;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
        padding: 10px 35px 10px 12px;
        font-size: 0.9rem;
        min-width: auto;
    }
    
    .cafe-name {
        font-size: 1rem;
    }
    
    .logo-img {
        width: 32px;
        height: 32px;
    }

    /* PRODUCTS AREA - Scrollable */
    .products-section {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: 8px;
    }
    
    .category-tabs-container {
        margin-bottom: 8px;
    }
    
    .category-tab {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 4px;
        max-height: none;
        overflow: visible;
    }
    
    .product-image {
        height: 75px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-info h3 {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    
    .price {
        font-size: 0.8rem;
    }

    /* CART SECTION - Fixed Bottom */
    .cart-section {
        flex-shrink: 0;
        max-height: none;
        border-radius: 16px 16px 0 0;
        padding: 14px;
        margin: 0 -8px -8px -8px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        z-index: 50;
    }
    
    .cart-header {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }
    
    .cart-header h2 {
        font-size: 1rem;
    }
    
    .cart-items {
        max-height: 80px;
        overflow-y: auto;
        margin-bottom: 8px;
    }
    
    .cart-item {
        padding: 6px 0;
        gap: 6px;
    }
    
    .item-name {
        font-size: 0.8rem;
    }
    
    .item-price {
        font-size: 0.7rem;
    }
    
    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }
    
    .qty-value {
        font-size: 0.8rem;
        min-width: 18px;
    }
    
    .delete-btn {
        font-size: 0.9rem;
    }
    
    .item-total {
        font-size: 0.8rem;
        min-width: 55px;
    }
    
    .cart-footer {
        padding-top: 8px;
    }
    
    .cart-summary {
        margin-bottom: 8px;
    }
    
    .summary-row {
        font-size: 0.75rem;
        margin-bottom: 3px;
    }
    
    .summary-row.total-row {
        font-size: 0.95rem;
        margin-top: 4px;
        padding-top: 4px;
    }
    
    /* DISCOUNT */
    .discount-section {
        padding: 6px;
        margin: 6px 0;
    }
    
    .discount-section input {
        padding: 5px;
        font-size: 0.75rem;
        width: 40px;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
    
    /* PAYMENT */
    .payment-methods {
        gap: 6px;
        margin: 8px 0;
    }
    
    .radio-label {
        padding: 6px 10px;
        font-size: 0.75rem;
        gap: 4px;
    }
    
    /* CHECKOUT BUTTON */
    #checkout-btn {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* ==========================================
   RESPONSIVE - VERY SMALL (max 380px)
   ========================================== */
@media (max-width: 380px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .product-image {
        height: 65px;
    }
    
    .product-info h3 {
        font-size: 0.65rem;
    }
    
    .price {
        font-size: 0.7rem;
    }
    
    .cart-section {
        padding: 10px;
    }
    
    .cart-items {
        max-height: 60px;
    }
    
    .discount-section input {
        width: 35px;
    }
}

/* ==========================================
   SCROLLBARS
   ========================================== */
.cart-items::-webkit-scrollbar,
.products-grid::-webkit-scrollbar {
    width: 3px;
}

.cart-items::-webkit-scrollbar-thumb,
.products-grid::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 2px;
}

.cart-items::-webkit-scrollbar-track,
.products-grid::-webkit-scrollbar-track {
    background: transparent;
}
