/* Pizza POS — واجهة عربية RTL */
:root {
  --tomato: #c8261c;
  --tomato-dark: #9e1c14;
  --basil: #2f6b3c;
  --basil-deep: #1d3b30;
  --ink: #24303a;
  --muted: #6b7682;
  --line: #e2e5e9;
  --page: #f2f4f6;
  --surface: #ffffff;
  --bs-primary: #c8261c;
  --bs-primary-rgb: 200, 38, 28;
  --bs-link-color: #c8261c;
  --bs-link-color-rgb: 200, 38, 28;
  --bs-body-font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

body { background: var(--page); color: var(--ink); font-family: var(--bs-body-font-family); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; }

.btn-primary { --bs-btn-bg: var(--tomato); --bs-btn-border-color: var(--tomato); --bs-btn-hover-bg: var(--tomato-dark);
  --bs-btn-hover-border-color: var(--tomato-dark); --bs-btn-active-bg: var(--tomato-dark); --bs-btn-disabled-bg: var(--tomato); --bs-btn-disabled-border-color: var(--tomato); }
.btn-success { --bs-btn-bg: var(--basil); --bs-btn-border-color: var(--basil); --bs-btn-hover-bg: #255731; --bs-btn-hover-border-color: #255731; --bs-btn-active-bg: #1f4a29; }
.btn-outline-primary { --bs-btn-color: var(--tomato); --bs-btn-border-color: var(--tomato); --bs-btn-hover-bg: var(--tomato); --bs-btn-hover-border-color: var(--tomato); --bs-btn-active-bg: var(--tomato); }
.text-primary { color: var(--tomato) !important; }
.bg-primary { background-color: var(--tomato) !important; }
.form-control:focus, .form-select:focus { border-color: #e48a84; box-shadow: 0 0 0 .2rem rgba(200, 38, 28, .15); }
:focus-visible { outline: 2px solid var(--tomato); outline-offset: 2px; }

/* ===== Shell ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex-shrink: 0; background: var(--basil-deep); color: #d9e4de; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 18px 20px 14px; font-weight: 700; font-size: 1.15rem; color: #fff; display: flex; align-items: center; gap: 10px; }
.sidebar .brand i { color: #ff8a65; font-size: 1.4rem; }
.sidebar .group { padding: 14px 20px 4px; font-size: .78rem; color: #8fb0a2; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: #d9e4de; text-decoration: none; border-inline-start: 3px solid transparent; }
.sidebar a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav-item.active { background: rgba(255,255,255,.1); color: #fff; border-inline-start-color: #ff8a65; }
.sidebar .pos-link { margin: 12px 16px 6px; background: var(--tomato); color: #fff; border-radius: 8px; padding: 11px 14px; text-decoration: none; display: flex; gap: 10px; align-items: center; font-weight: 700; }
.sidebar .pos-link:hover { background: var(--tomato-dark); color: #fff; }
.sidebar .user-box { margin-top: auto; padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: .9rem; }
.main { flex: 1; min-width: 0; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 1.2rem; margin: 0; font-weight: 700; }
.content { padding: 22px 24px 40px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1rem; margin: 0; font-weight: 700; }
.panel-body { padding: 18px; }
.table { margin: 0; --bs-table-bg: transparent; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; background: #f8f9fa; }
.table td { vertical-align: middle; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: .88rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 2px; }
.stat .value small { font-size: .85rem; color: var(--muted); font-weight: 500; }

.mobile-toggle { display: none; }
@media (max-width: 991px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 1040; transform: translateX(100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 16px 12px 30px; }
  .topbar { padding: 10px 12px; }
}

/* ===== POS ===== */
.pos { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.pos-top { background: var(--basil-deep); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 14px; flex-shrink: 0; }
.pos-top a, .pos-top .btn-link { color: #d9e4de; text-decoration: none; }
.pos-top a:hover { color: #fff; }
.pos-body { flex: 1; display: flex; min-height: 0; }
.pos-menu { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cat-strip { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.cat-btn { border: 2px solid var(--c); color: var(--c); background: #fff; border-radius: 8px; padding: 8px 16px; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.cat-btn.active { background: var(--c); color: #fff; }
.menu-search { padding: 10px 12px 0; }
.product-grid { flex: 1; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; }
.p-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 8px; padding: 10px; text-align: start; display: flex; flex-direction: column; gap: 4px; min-height: 98px; cursor: pointer; user-select: none; }
.p-card:hover { border-color: var(--c); }
.p-card:active { transform: scale(.98); }
.p-card img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.p-card .p-name { font-weight: 700; line-height: 1.3; }
.p-card .p-price { margin-top: auto; color: var(--muted); font-size: .88rem; }
.p-card .p-code { font-size: .72rem; color: var(--muted); }

.pos-cart { width: 420px; flex-shrink: 0; background: var(--surface); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.type-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.type-tabs button { border: 0; background: #fff; padding: 11px 4px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.type-tabs button.active { color: var(--tomato); border-bottom-color: var(--tomato); background: #fdf3f2; }
.order-meta { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.cart-lines { flex: 1; overflow-y: auto; }
.cart-line { padding: 9px 12px; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; }
.cart-line .ln-name { font-weight: 700; }
.cart-line .ln-sub { font-size: .82rem; color: var(--muted); grid-column: 1 / -1; }
.cart-line .ln-note { font-size: .82rem; color: var(--tomato); grid-column: 1 / -1; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; }
.qty-ctl button { border: 0; background: none; width: 30px; height: 30px; font-weight: 700; }
.qty-ctl span { min-width: 30px; text-align: center; font-weight: 700; }
.cart-empty { color: var(--muted); text-align: center; padding: 50px 20px; }
.cart-empty i { font-size: 2.6rem; display: block; margin-bottom: 8px; color: #c9ced4; }
.totals { border-top: 1px solid var(--line); padding: 10px 12px; font-size: .95rem; }
.totals .row-t { display: flex; justify-content: space-between; padding: 2px 0; }
.totals .grand { font-size: 1.35rem; font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.pay-actions { padding: 10px 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-actions .btn { padding: 12px 6px; font-weight: 700; }
.pay-actions .btn-lg-main { grid-column: 1 / -1; font-size: 1.1rem; }

.size-opt, .extra-opt { border: 2px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: #fff; width: 100%; }
.size-opt.active { border-color: var(--tomato); background: #fdf3f2; }
.extra-opt.active { border-color: var(--basil); background: #eef6f0; }
.method-btns .btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.quick-cash .btn { min-width: 64px; }

@media (max-width: 991px) {
  .pos { height: auto; overflow: visible; }
  .pos-body { flex-direction: column; }
  .pos-cart { width: 100%; border-inline-start: 0; border-top: 1px solid var(--line); }
  .product-grid { max-height: 55vh; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ===== Kitchen ===== */
.kds { background: #222a30; min-height: 100vh; color: #fff; }
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; padding: 16px; }
.ticket { background: #fff; color: var(--ink); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ticket-head { padding: 10px 14px; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.ticket-head .no { font-size: 1.5rem; font-weight: 800; }
.ticket.st-pending .ticket-head { background: #57606a; }
.ticket.st-preparing .ticket-head { background: #c77c02; }
.ticket.st-ready .ticket-head { background: var(--basil); }
.ticket.late .ticket-head { background: var(--tomato); }
.ticket ul { list-style: none; margin: 0; padding: 8px 14px; flex: 1; }
.ticket li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ticket li .q { font-weight: 800; font-size: 1.05rem; margin-inline-end: 6px; display: inline-block; min-width: 28px; text-align: center; background: var(--ink); color: #fff; border-radius: 4px; padding: 0 4px; }
.ticket li .x { font-size: .85rem; color: var(--basil); }
.ticket li .n { font-size: .85rem; color: var(--tomato); font-weight: 700; }
.ticket .t-foot { padding: 10px 14px; display: flex; gap: 8px; }
.ticket .t-foot .btn { flex: 1; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* أسعار العملاء */
.p-card .p-cprice { font-size: .78rem; color: var(--tomato); font-weight: 600; }
.cart-line .ln-cmp { font-size: .8rem; grid-column: 1 / -1; }
.cart-line .ln-cmp .btn-link { font-size: .8rem; }
