/* assets/css/pos.css */
body {
    background-color: #f1f3f5;
    overflow: hidden;
    /* No scroll on POS container */
}

.pos-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.pos-header {
    height: 60px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.pos-header a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.pos-header .dropdown-item {
    color: #2b2d42;
}

.pos-header .dropdown-menu {
    color: #2b2d42;
}

.pos-header .dropdown-menu .text-muted {
    color: #6c757d !important;
}

.pos-header a:hover {
    color: #e0e7ff;
}

.pos-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.pos-left {
    flex: 0 0 70%;
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    background-color: #f4f6f9;
}

.pos-right {
    flex: 0 0 30%;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.03);
}

/* Hide spin buttons for inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Print Optimization */
@media print {
    @page {
        margin: 0;
        size: auto;
    }

    body {
        margin: 0;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .no-print {
        display: none !important;
    }
}

/* Category Strip */
.category-strip {
    flex: 0 0 60px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.category-strip::-webkit-scrollbar {
    height: 6px;
}

.category-strip::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.category-btn {
    display: inline-block;
    padding: 10px 24px;
    margin-right: 12px;
    border-radius: 30px;
    background: white;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.category-btn.active,
.category-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
    transform: translateY(-2px);
}

/* Product Grid */
.product-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 25px;
    padding: 10px 20px 30px 10px;
    align-content: start; /* Prevents vertical stretching */
}

.product-grid::-webkit-scrollbar {
    width: 6px;
}

.product-grid::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Back to center */
    align-items: center;
    position: relative;
    aspect-ratio: 1 / 1.15; /* Slightly taller than square to fit text */
}

.product-card i {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.product-card .text-muted.small {
    font-size: 0.75rem;
    line-height: 1.1;
}

.product-card:active {
    transform: scale(0.95);
    background-color: #f8fafc;
    border-color: var(--primary-color);
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
    padding: 0 4px;
}

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

.product-card .small.fw-bold {
    font-size: 0.7rem;
    margin-top: 2px;
}

/* Cart Section */
.cart-header {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h5 {
    margin: 0;
    font-weight: 700;
    color: #334155;
}

.cart-list {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    animation: fadeIn 0.3s ease-in;
}

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

.cart-item-name {
    font-weight: 700;
    margin-bottom: 2px;
    color: #1e293b;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #e2e8f0;
}

.qty-btn.danger {
    color: #dc2626;
    background: #fee2e2;
}

.qty-btn.danger:hover {
    background: #fecaca;
}

.cart-item-total {
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 80px;
}

.cart-totals {
    background: #f8fafc;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.total-line {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #64748b;
    font-weight: 500;
}

.total-grand {
    display: flex;
    justify-content: space-between;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed #cbd5e1;
}

.pos-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 20px;
    background: white;
}

.btn-pay {
    padding: 16px;
    font-size: 1.3rem;
    font-weight: 800;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-pay:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-pay:active {
    transform: translateY(0);
}

.btn-cancel:hover {
    background: #fecaca;
}

/* Queue Tabs */
.queue-tabs {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
}

.queue-tab {
    padding: 6px 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.queue-tab .btn-close-tab {
    font-size: 0.7rem;
    padding: 2px;
    border-radius: 50%;
    transition: background 0.2s;
}

.queue-tab.active .btn-close-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Customer Area */
.customer-area {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

#customer-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    cursor: pointer;
}

#customer-display:hover {
    border-color: var(--primary-color);
    background: #f1f5ff;
}

.customer-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
}

.customer-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.customer-item:hover {
    background: #f8fafc;
}

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