/* =====================================================
 * 06-views-pos.css — Point of Sale (POS) View
 * ===================================================== */

/* ── POS Layout ── */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--margin-main);
    height: calc(100vh - 80px - (var(--margin-main) * 2));
    box-sizing: border-box;
    overflow: hidden;
}

.pos-products-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-card);
    overflow-y: auto;
    padding-bottom: 2rem;
    padding-top: 10px;
}

/* ── POS Product Cards ── */
.pos-item-card {
    background: white; border: 1px solid var(--border);
    overflow: hidden; cursor: pointer; transition: all 0.2s;
    display: flex; flex-direction: column;
}
.pos-item-card:hover { border-color: var(--primary); background: #fcfbff; }
.pos-item-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #fcfbff; border-bottom: 1px solid var(--border); }
.pos-item-info { padding: 12px; text-align: center; }
.pos-item-name {
    font-size: 0.95rem; font-weight: 700; margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
}
.pos-item-price { color: var(--primary); font-weight: 800; font-size: 1rem; }

/* ── Category Tabs ── */
.pos-category-tabs-container { 
    margin-bottom: var(--margin-main); 
    overflow-x: auto; 
    white-space: nowrap; 
    padding-bottom: 8px;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15px, black calc(100% - 15px), transparent);
}
.pos-category-tabs-container:active { cursor: grabbing; }
.pos-category-tabs { display: flex; gap: 8px; padding: 2px 0; }
.pos-tab-item { position: relative; }
.pos-tab-item input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.pos-tab-label {
    display: inline-flex; align-items: center; justify-content: center; height: var(--btn-height); padding: 0 20px; background: white;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: all 0.2s ease; color: var(--text-dark);
}
.pos-tab-item input[type="radio"]:checked + .pos-tab-label { background: var(--primary); color: white; border-color: var(--primary); }
.pos-tab-label:hover { border-color: var(--primary); background: #f8f9fa; }

.pos-category-group-title {
    grid-column: 1 / -1; font-size: 1.1rem; font-weight: 800; color: var(--primary);
    padding: 0 0 0.5rem 0; border-bottom: 2px solid var(--primary-light);
    margin-bottom: 1rem; position: sticky; top: -1px; z-index: 5; background: white;
}

/* ── POS Cart Section ── */
.pos-cart-section {
    background: white; border: 1px solid #000;
    display: flex; flex-direction: column; overflow: hidden;
}
.pos-cart-card { background: transparent; border: none; height: 100%; display: flex; flex-direction: column; box-shadow: none; }
.pos-cart-header {
    padding: 20px 24px; border-bottom: 2px solid var(--primary-light);
    display: flex; justify-content: space-between; align-items: center; background: white;
}
.pos-cart-header h3 { font-size: 1.25rem; font-weight: 900; color: var(--primary); }

.btn-clear-cart {
    background: #fff5f5; color: #e05252; border: 1px solid #fecaca;
    padding: 6px 12px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: 0.2s;
}
.btn-clear-cart:hover { background: #e05252; color: white; }

.pos-cart-list { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.empty-cart-msg { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.95rem; }

/* ── Cart Items ── */
.pos-cart-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: #ffffff; border: 1px solid #f1f5f9;
    margin-bottom: 8px; transition: all 0.2s ease;
}
.pos-cart-item:hover { border-color: var(--primary-light); background: #fcfdfe; }
.cart-item-main { display: flex; align-items: center; gap: 12px; flex: 1; }
.cart-item-thumbnail { width: 44px; height: 44px; border-radius: 0 !important; object-fit: cover; background: #f8fafc; border: 1px solid #edf2f7; }
.cart-item-details  { display: flex; flex-direction: column; }
.cart-item-name     { font-size: 0.9rem; font-weight: 700; color: var(--text-dark); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price    { font-size: 0.8rem; color: var(--primary); font-weight: 800; }
.cart-item-actions  { display: flex; align-items: center; gap: 12px; }

.cart-qty-controls  { display: flex; align-items: center; background: #f1f5f9; padding: 2px; border-radius: 0 !important; }
.qty-btn { width: 28px; height: 28px; border: none; background: #ffffff; border-radius: 0 !important; color: #475569; cursor: pointer; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.qty-btn:hover { background: var(--primary); color: white; }
.qty-number { padding: 0 10px; font-size: 0.85rem; font-weight: 800; min-width: 28px; text-align: center; }

.cart-remove-btn { width: 32px; height: 32px; border: none; background: #fff1f2; color: #ef4444; border-radius: 0 !important; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.cart-remove-btn:hover { background: #ef4444; color: white; }

/* Legacy cart item (kept for compatibility) */
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: #ffffff; border: 1px solid var(--border); }
.cart-it-btn { width: 26px; height: 26px; border: 1px solid var(--border); background: #f8f9fa; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.75rem; }
.cart-it-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ── POS Summary Form ── */
/* ── POS Summary Form ── */
.pos-cart-summary { background: #fcfcfd; border-top: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.pos-form-section { background: white; border: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pos-form-header  { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 0.9rem; color: var(--primary); margin-bottom: 4px; }
.pos-form-header i { font-size: 1rem; }
.pos-check-group  { margin-right: auto; display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.pos-check-group label { cursor: pointer; }

/* ── POS Inputs ── */
.pos-input-group  { position: relative; display: flex; align-items: center; flex: 1; }
.pos-input-group i { position: absolute; right: 12px; color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
.pos-input-group input, .pos-input-group select {
    width: 100%; height: var(--btn-height); padding: 0 36px 0 12px; border: 1px solid var(--border);
    font-size: 0.9rem; outline: none; transition: 0.2s; background: #f8f9fa;
}
.pos-input-group input:focus, .pos-input-group select:focus {
    border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(142,113,240,0.08);
}
.pos-input-row { display: flex; gap: 10px; }
.pos-input-group.search input { border-color: var(--primary-light); background: #f0f7ff; }

.pos-search-results {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: white; z-index: 1000; border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); max-height: 200px; overflow-y: auto;
}

/* ── Summary Lines ── */
.pos-summary-details { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.summary-line { display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 500; color: var(--text-muted); }
.summary-line.discount { align-items: center; color: #e05252; margin-top: 5px; }
.pos-discount-wrapper {
    display: flex;
    align-items: center;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 0 !important;
    padding: 0 8px;
    height: var(--btn-height);
    transition: all 0.2s;
}
.pos-discount-wrapper:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
    background: white;
}
.pos-discount-field {
    width: 50px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 800;
    color: #e05252;
    font-size: 1rem;
    outline: none;
    padding: 0;
}
.pos-discount-type-select {
    border: none;
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 0 !important;
    font-weight: 800;
    font-size: 0.85rem;
    color: #e05252;
    cursor: pointer;
    outline: none;
    margin-right: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.summary-line.grand-total { margin-top: 8px; padding-top: 12px; border-top: 2px dashed var(--border); font-size: 1.25rem; font-weight: 900; color: var(--text-dark); }
.summary-line.grand-total span:last-child { color: var(--primary); }

/* Legacy summary row */
.summary-row    { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.95rem; }
.summary-row.total { margin-top: 10px; padding-top: 10px; border-top: 2px dashed var(--border); font-weight: 800; font-size: 1.2rem; color: var(--primary); }

/* ── Checkout Buttons ── */
.btn-checkout {
    width: 100%; margin-top: 15px; padding: 15px; border-radius: var(--radius-sm);
    background: var(--primary); color: white; border: none; font-weight: 800; font-size: 1.05rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.3s ease;
}
.btn-checkout:hover { background: var(--primary-dark); }

.btn-checkout-modern {
    width: 100%; height: var(--btn-height); background: var(--primary); color: white; border: none;
    font-size: 1.2rem; font-weight: 900; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    transition: all 0.3s; box-shadow: 0 4px 15px rgba(142,113,240,0.3);
}
.btn-checkout-modern:hover { background: var(--primary-dark); }
.btn-checkout-modern i { font-size: 1.4rem; }
