/* ================================================================
   RAWAJ POS — شاشة نقطة البيع v3 (محترفة)
   ================================================================ */

/* ── الحاوية الرئيسية ─────────────────────────────────────── */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 16px;
    height: calc(100vh - 110px);
}

/* ── الجانبان ─────────────────────────────────────────────── */
.pos-left, .pos-right {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pos-right {
    border: 2px solid #e2e8f0;
}

/* ════════════════════════════════════════════════════════════
   شريط البحث + الباركود
   ════════════════════════════════════════════════════════════ */
.pos-search-bar {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 2px solid #e8eef4;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* حقل الباركود */
.barcode-zone { width: 100%; }

.barcode-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
    border-radius: 12px;
    padding: 10px 14px;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.barcode-input-wrap.scanning {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.barcode-input-wrap:focus-within {
    border-color: #C9A84C;
    box-shadow: 0 0 0 3px rgba(201,168,76,0.2);
}

.barcode-icon-big {
    font-size: 22px;
    color: #C9A84C;
    flex-shrink: 0;
}

.barcode-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    min-width: 0;
}
.barcode-input-wrap input::placeholder { color: rgba(255,255,255,0.45); }

.barcode-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.barcode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    transition: background 0.3s;
    animation: bcPulse 2s infinite;
}
@keyframes bcPulse {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
#barcodeStatusTxt {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
}

/* حقل البحث بالاسم */
.name-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    transition: all 0.2s;
}
.name-search-wrap:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.name-search-wrap i {
    color: #94a3b8;
    font-size: 16px;
    flex-shrink: 0;
}
.name-search-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    min-width: 0;
    background: transparent;
    color: #0f172a;
}
.pos-filter-btn {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.pos-filter-btn:hover { background: #e2e8f0; color: #0f172a; }

/* ════════════════════════════════════════════════════════════
   شبكة المنتجات
   ════════════════════════════════════════════════════════════ */
.pos-products {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    align-content: start;
}
.pos-products::-webkit-scrollbar { width: 6px; }
.pos-products::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── بطاقة المنتج ─────────────────────────────────────────── */
.product-card {
    background: #fff;
    border: 2px solid #e8eef4;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.product-card:hover:not(.disabled) {
    border-color: #C9A84C;
    box-shadow: 0 8px 24px rgba(201,168,76,0.2);
    transform: translateY(-3px);
}
.product-card:active:not(.disabled) { transform: translateY(0); }
.product-card.disabled { opacity: 0.55; cursor: not-allowed; }

.pc-image {
    width: 100%;
    height: 110px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.pc-image img { width: 100%; height: 100%; object-fit: cover; }
.pc-image i   { font-size: 40px; color: #cbd5e1; }

.pc-unit-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(15,23,42,0.75);
    color: #C9A84C;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.pc-body {
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}
.pc-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pc-barcode {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
    font-family: monospace;
}
.pc-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.pc-price {
    font-size: 15px;
    font-weight: 900;
    color: #0c1b33;
}
.pc-piece-price {
    font-size: 11px;
    color: #3b82f6;
    font-weight: 700;
}
.pc-stock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: wrap;
}
.pc-stock {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.pc-stock.out-of-stock { background:#fee2e2; color:#dc2626; }
.pc-stock.low-stock    { background:#fff7ed; color:#ea580c; }
.pc-stock.medium-stock { background:#fefce8; color:#ca8a04; }
.pc-stock.in-stock     { background:#f0fdf4; color:#16a34a; }
.pc-stock.low          { background:#fee2e2; color:#dc2626; }

.pc-piece-btn {
    font-size: 10px;
    font-weight: 700;
    color: #3b82f6;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 3px 7px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.pc-piece-btn:hover { background: #3b82f6; color: #fff; }

/* ════════════════════════════════════════════════════════════
   السلة — الجانب الأيمن
   ════════════════════════════════════════════════════════════ */
.cart-header {
    background: linear-gradient(150deg, #0c1b33, #1e3a5f);
    padding: 14px 16px;
}
.cart-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
}
.cart-title i { color: #C9A84C; font-size: 18px; }

.cart-count-badge {
    background: #C9A84C;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.cart-total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: 10px;
    padding: 8px 14px;
}
.cart-total-label { font-size: 12px; color: rgba(255,255,255,0.6); font-weight: 600; }
.cart-total-amount { font-size: 18px; font-weight: 900; color: #C9A84C; direction: ltr; }

/* قائمة السلة */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cart-items::-webkit-scrollbar { width: 5px; }
.cart-items::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }

.empty-cart {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
}
.empty-cart i    { font-size: 40px; color: #e2e8f0; }
.empty-cart p    { font-size: 14px; font-weight: 600; margin: 0; }
.empty-cart small{ font-size: 12px; }

/* ── عنصر في السلة ──────────────────────────────────────── */
.cart-item {
    background: #fff;
    border: 1.5px solid #e8eef4;
    border-radius: 12px;
    padding: 10px 12px;
    transition: border-color 0.15s;
}
.cart-item:hover { border-color: #C9A84C; }

.ci-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.ci-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ci-unit-lbl {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
}
.ci-del {
    background: #fee2e2;
    border: none;
    color: #dc2626;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.ci-del:hover { background: #dc2626; color: #fff; }

.ci-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ci-minus, .ci-plus {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.ci-minus:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.ci-plus:hover  { background: #dcfce7; border-color: #86efac; color: #16a34a; }

.ci-qty-wrap {
    min-width: 44px;
    height: 32px;
    background: #0f172a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 0 8px;
    transition: all 0.15s;
}
.ci-qty-wrap:hover { background: #1e3a5f; }
.ci-qty {
    font-size: 15px;
    font-weight: 900;
    color: #C9A84C;
}
.ci-edit-icon {
    font-size: 8px;
    color: rgba(255,255,255,0.35);
}

.ci-price-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}
.ci-unit-price {
    font-size: 11px;
    color: #94a3b8;
    direction: ltr;
}
.ci-total {
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
    direction: ltr;
}

/* شارات الضريبة */
.tax-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
}
.tax-badge.exempt { background: #dcfce7; color: #166534; }

/* ══ الملخص ══ */
.cart-summary {
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 2px solid #e8eef4;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    color: #64748b;
    font-weight: 600;
}
.summary-row:last-child { border-bottom: none; }
.summary-row.total {
    font-size: 16px;
    font-weight: 900;
    color: #0f172a;
    padding-top: 8px;
}
.discount-val { color: #dc2626; }

/* ══ أزرار الإجراءات ══ */
.cart-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 12px 14px;
    background: #fff;
    border-top: 2px solid #e8eef4;
}

.btn-checkout {
    padding: 14px 10px;
    background: linear-gradient(135deg, #C9A84C, #A8842A);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(201,168,76,0.35);
}
.btn-checkout:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(201,168,76,0.45); }
.btn-checkout:disabled { background: #e2e8f0; color: #94a3b8; box-shadow: none; cursor: not-allowed; }

.btn-hold {
    padding: 14px 12px;
    background: #f0f9ff;
    color: #0284c7;
    border: 1.5px solid #bae6fd;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}
.btn-hold:hover { background: #0284c7; color: #fff; }

.btn-clear {
    padding: 14px 12px;
    background: #fff1f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}
.btn-clear:hover { background: #dc2626; color: #fff; }

/* ══ empty states ══ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
}
.empty-state i    { font-size: 48px; color: #e2e8f0; }
.empty-state p    { font-size: 15px; font-weight: 600; color: #64748b; margin: 0; }
.empty-state small{ font-size: 12px; }

/* ══ responsive ══ */
@media (max-width: 900px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .pos-left { height: 60vh; }
    .pos-right { height: 45vh; }
    .pos-products {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}
@media (max-width: 600px) {
    .cart-actions { grid-template-columns: 1fr 1fr; }
    .btn-checkout { grid-column: 1 / -1; }
    .pos-products { grid-template-columns: repeat(2, 1fr); }
}
