/* ============================================================
   No Line — التنسيقات
   الخطوط: Tajawal للعناوين، IBM Plex Sans Arabic للنصوص،
           IBM Plex Mono للأرقام والتذاكر
   ============================================================ */

:root {
  --ink:        #141C1A;
  --ink-soft:   #5C6B66;
  --paper:      #F2F5F3;
  --surface:    #FFFFFF;
  --line:       #DFE5E1;
  --line-soft:  #EDF1EE;

  --go:         #0E8F6E;   /* اللون الأساسي: أخضر الطازج */
  --go-dark:    #0A6B52;
  --go-tint:    #E4F4EE;
  --wait:       #C8811A;   /* قيد التحضير */
  --wait-tint:  #FBF0DD;
  --stop:       #C43D3D;
  --stop-tint:  #FAE7E7;
  --info-tint:  #E8EFF6;
  --info:       #2C5C8F;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  --shadow: 0 1px 2px rgba(20,28,26,.06), 0 8px 24px -12px rgba(20,28,26,.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 15px;
}

h1, h2, h3, h4, .display {
  font-family: "Tajawal", "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 .5rem;
  letter-spacing: -.01em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a { color: var(--go-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-feature-settings: "tnum"; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 620px; margin: 0 auto; padding: 0 16px; }

.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------------- الترويسة ---------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; max-width: 1040px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: .95rem;
}
.brand-name { font-family: "Tajawal", sans-serif; font-weight: 800; font-size: 1.1rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: var(--ink-soft); letter-spacing: .12em; text-transform: uppercase; }

.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; padding: 9px 14px;
  border-radius: 999px; font-size: .9rem; font-weight: 600;
}
.cart-btn:hover { text-decoration: none; background: #000; }
.cart-btn .count {
  background: var(--go); border-radius: 999px; min-width: 22px;
  padding: 0 6px; text-align: center; font-family: "IBM Plex Mono", monospace; font-size: .8rem;
}

/* ---------------- البطاقات ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-pad-0 { padding: 0; overflow: hidden; }

/* ---------------- الأزرار ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: .95rem; font-weight: 600;
  padding: 11px 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  background: var(--go); color: #fff;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--go-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid rgba(14,143,110,.35); outline-offset: 2px;
}
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-dark { background: var(--ink); }
.btn-dark:hover { background: #000; }
.btn-danger { background: var(--stop); }
.btn-danger:hover { background: #A93131; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- الحقول ---------------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password], input[type=tel],
input[type=date], input[type=email], select, textarea {
  width: 100%; padding: 11px 13px; font-family: inherit; font-size: .95rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: 14px; }
.field-hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------------- التنبيهات ---------------- */
.alert { padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: .92rem; }
.alert-success { background: var(--go-tint); color: var(--go-dark); }
.alert-error   { background: var(--stop-tint); color: var(--stop); }
.alert-info    { background: var(--info-tint); color: var(--info); }

/* ---------------- القائمة (أصناف الطعام) ---------------- */
.cat-nav { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a {
  white-space: nowrap; padding: 8px 15px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: .9rem; font-weight: 600;
}
.cat-nav a:hover { text-decoration: none; border-color: var(--go); }
.cat-nav a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.item-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column;
}
.item-thumb {
  height: 130px; background: var(--line-soft);
  display: grid; place-items: center; font-size: 2.4rem;
  background-size: cover; background-position: center;
}
.item-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item-name { font-family: "Tajawal", sans-serif; font-weight: 700; font-size: 1rem; }
.item-desc { font-size: .85rem; color: var(--ink-soft); flex: 1; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.price { font-family: "IBM Plex Mono", monospace; font-weight: 600; }

.opt-group { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.opt-group-title { font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
.opt-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500; margin-bottom: 4px; }
.opt-row input { width: auto; }
.opt-delta { margin-inline-start: auto; font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); font-size: .8rem; }

/* ---------------- السلة ---------------- */
.line-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.line-item:last-child { border-bottom: 0; }
.qty-box { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.qty-box button { width: 34px; height: 34px; border: 0; background: var(--surface); font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.qty-box button:hover { background: var(--line-soft); }
.qty-box span { width: 34px; text-align: center; font-family: "IBM Plex Mono", monospace; }

.totals { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-size: .95rem; }
.totals .grand { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }

/* ---------------- اختيار طريقة الاستلام والدفع ---------------- */
.choice { display: block; cursor: pointer; margin-bottom: 12px; }
.choice input { position: absolute; opacity: 0; }
.choice-face {
  border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 15px;
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}
.choice input:checked + .choice-face { border-color: var(--go); background: var(--go-tint); }
.choice input:focus-visible + .choice-face { outline: 3px solid rgba(14,143,110,.35); outline-offset: 2px; }
.choice-icon { font-size: 1.6rem; width: 40px; text-align: center; }
.choice-title { font-weight: 700; font-family: "Tajawal", sans-serif; }
.choice-desc { font-size: .84rem; color: var(--ink-soft); }

.conditional { display: none; padding: 4px 4px 8px; }
.conditional.show { display: block; }

/* ---------------- تذكرة الطابور (العنصر المميز) ---------------- */
.ticket {
  background: var(--surface); border: 2px dashed var(--ink);
  border-radius: var(--r-lg); padding: 30px 22px; text-align: center;
  position: relative; margin-top: 26px;
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 26px; height: 26px;
  background: var(--paper); border-radius: 50%; transform: translateY(-50%);
}
.ticket::before { inset-inline-start: -15px; }
.ticket::after  { inset-inline-end: -15px; }
.ticket-label { font-size: .78rem; letter-spacing: .22em; color: var(--ink-soft); text-transform: uppercase; }
.ticket-number {
  font-family: "IBM Plex Mono", monospace; font-weight: 600;
  font-size: clamp(4rem, 22vw, 7rem); line-height: 1; margin: 8px 0 6px;
}
.ticket-meta { font-size: .9rem; color: var(--ink-soft); }

/* ---------------- الشارات ---------------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
}
.badge-new       { background: var(--info-tint); color: var(--info); }
.badge-preparing { background: var(--wait-tint); color: var(--wait); }
.badge-ready     { background: var(--go-tint); color: var(--go-dark); }
.badge-completed { background: var(--line-soft); color: var(--ink-soft); }
.badge-cancelled { background: var(--stop-tint); color: var(--stop); }
.badge-paid      { background: var(--go-tint); color: var(--go-dark); }
.badge-unpaid    { background: var(--wait-tint); color: var(--wait); }
.badge-refunded  { background: var(--line-soft); color: var(--ink-soft); }

/* ---------------- الجداول ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 11px 12px; text-align: start; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.data th { background: var(--line-soft); font-weight: 700; font-size: .82rem; color: var(--ink-soft); }
table.data tbody tr:hover { background: #FAFBFA; }

/* ---------------- لوحة التحكم ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--ink); color: #C9D4D0;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand-mark { background: #fff; color: var(--ink); }
.sidebar .brand-name, .sidebar .brand { color: #fff; }
.sidebar nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  color: #C9D4D0; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: .92rem; font-weight: 600; display: flex; gap: 10px; align-items: center;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--go); color: #fff; }
.sidebar .sep { height: 1px; background: rgba(255,255,255,.12); margin: 12px 4px; }

.admin-main { flex: 1; min-width: 0; }
.admin-head {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.admin-body { padding: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
}
.stat-label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-family: "IBM Plex Mono", monospace; font-size: 1.8rem; font-weight: 600; margin-top: 4px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .88rem; }
.bar-track { flex: 1; height: 9px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--go); border-radius: 999px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { width: auto; }

/* ---------------- شاشة الطابور ---------------- */
.screen { background: var(--ink); color: #fff; min-height: 100vh; padding: 28px; }
.screen h1 { color: #fff; font-size: 1.6rem; }
.screen-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 18px; }
.screen-col h2 { font-size: 1rem; letter-spacing: .18em; color: #8C9A95; text-transform: uppercase; }
.screen-nums { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.screen-num {
  font-family: "IBM Plex Mono", monospace; font-size: 2.6rem; font-weight: 600;
  background: rgba(255,255,255,.07); border-radius: var(--r-md);
  padding: 14px 22px; min-width: 110px; text-align: center;
}
.screen-num.ready { background: var(--go); }

/* ---------------- الطباعة ---------------- */
@media print {
  .topbar, .btn, .sidebar, .admin-head, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 0; }
}

@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .screen-cols { grid-template-columns: 1fr; }
  .admin-body { padding: 14px; }
}

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