/* =====================================================================
   مبشور وتنور — لوحة تحكم الكاشير الصوتي
   ثيم: جمر التنّور على فحم (Ember on Charcoal) — RTL
   ===================================================================== */

:root {
  /* الخلفيات — فحم دافئ لا أسود صريح */
  --bg:        #15110d;
  --bg-2:      #1e1813;
  --bg-3:      #2a2118;
  --bg-4:      #34291c;
  --line:      #3a2e22;
  --line-soft: #2c2319;

  /* النص — كريمي دافئ */
  --text:      #f2e9dc;
  --text-dim:  #b5a48f;
  --text-faint:#7d6f5e;

  /* جمر التنّور — اللون المميّز */
  --ember:      #ef8a2b;
  --ember-soft: #f4a857;
  --ember-deep: #c96a18;
  --ember-glow: rgba(239, 138, 43, .30);

  /* دلالات */
  --red:    #d1492f;
  --red-bg: rgba(209, 73, 47, .12);
  --green:    #5fa463;
  --green-bg: rgba(95, 164, 99, .12);
  --amber-bg: rgba(239, 138, 43, .12);

  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow:    0 18px 40px -22px rgba(0,0,0,.8);
  --shadow-glow: 0 0 0 1px var(--ember-glow), 0 14px 50px -12px var(--ember-glow);

  --font-display: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-body:    "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(239,138,43,.10), transparent 60%),
    radial-gradient(800px 480px at 6% 0%, rgba(201,106,24,.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ember); color: #1a130b; }

/* ── شريط العلوي ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(21,17,13,.92), rgba(21,17,13,.78));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand .flame {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 120%, var(--ember-soft), var(--ember-deep));
  box-shadow: 0 6px 18px -6px var(--ember-glow), inset 0 1px 0 rgba(255,255,255,.25);
  font-size: 20px;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800; letter-spacing: -.01em;
}
.brand .sub { font-size: 12px; color: var(--text-dim); font-weight: 500; margin-top: -3px; }

.health {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  padding: 7px 13px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--bg-2);
}
.health .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint); box-shadow: 0 0 0 0 transparent;
}
.health.up   .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.health.down .dot { background: var(--red);   box-shadow: 0 0 10px var(--red); }

/* ── تبويبات ─────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px) 0;
}
.tab {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600;
  color: var(--text-dim); background: transparent;
  padding: 10px 18px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color .18s, background .18s, transform .1s;
}
.tab:hover { color: var(--text); background: var(--bg-2); }
.tab[aria-selected="true"] {
  color: #1a130b;
  background: linear-gradient(180deg, var(--ember-soft), var(--ember));
  box-shadow: 0 8px 20px -10px var(--ember-glow);
}
.tab .ic { font-size: 16px; }

/* ── الحاوية ─────────────────────────────────────────────── */
main { padding: 22px clamp(16px, 4vw, 40px) 80px; max-width: 1180px; margin-inline: auto; }
.panel { display: none; animation: rise .35s ease both; }
.panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.panel-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; }
.panel-head .desc { color: var(--text-dim); font-size: 13.5px; margin-top: 2px; }

/* ── أزرار ───────────────────────────────────────────────── */
.btn {
  appearance: none; cursor: pointer; font-family: var(--font-body);
  font-size: 14px; font-weight: 700; color: var(--text);
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: #1a130b; border-color: transparent;
  background: linear-gradient(180deg, var(--ember-soft), var(--ember));
  box-shadow: 0 10px 24px -12px var(--ember-glow);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--ember-soft), var(--ember)); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffd9cf; background: var(--red-bg); border-color: rgba(209,73,47,.4); }
.btn.danger:hover { background: rgba(209,73,47,.2); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── بطاقات / جداول ──────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cat-group { margin-bottom: 26px; }
.cat-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  color: var(--ember-soft); margin: 0 4px 12px;
}
.cat-title .count {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  color: var(--text-dim); background: var(--bg-3);
  padding: 2px 9px; border-radius: 999px;
}

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

.item {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  display: flex; flex-direction: column; gap: 9px;
  transition: border-color .15s, transform .1s;
}
.item:hover { border-color: var(--ember-deep); transform: translateY(-2px); }
.item .row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item .name { font-weight: 700; font-size: 15.5px; }
.item .price-tag {
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  color: var(--ember-soft); white-space: nowrap;
}
.item .meta { font-size: 12.5px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; font-weight: 600; color: var(--text-dim);
  background: var(--bg-3); border: 1px solid var(--line-soft);
  padding: 2px 9px; border-radius: 999px;
}
.chip.on  { color: var(--green);  background: var(--green-bg); border-color: transparent; }
.chip.off { color: var(--red);    background: var(--red-bg);   border-color: transparent; }
.chip.ember { color: var(--ember-soft); background: var(--amber-bg); border-color: transparent; }
.item .actions { display: flex; gap: 7px; margin-top: 3px; }

/* ── الطلبات ─────────────────────────────────────────────── */
.orders-wrap { display: flex; flex-direction: column; gap: 12px; }
.order {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.order > summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.order > summary::-webkit-details-marker { display: none; }
.order .o-id { font-weight: 700; }
.order .o-id small { color: var(--text-faint); font-weight: 500; font-family: var(--font-body); }
.order .o-right { display: flex; align-items: center; gap: 12px; }
.order .o-total { font-family: var(--font-display); font-weight: 800; color: var(--ember-soft); }
.status {
  font-size: 11.5px; font-weight: 700; padding: 3px 11px; border-radius: 999px;
}
.status.draft     { color: var(--text-dim);  background: var(--bg-3); }
.status.confirmed { color: var(--green);      background: var(--green-bg); }
.status.cancelled { color: var(--red);        background: var(--red-bg); }
.order .o-body { padding: 0 16px 14px; border-top: 1px solid var(--line-soft); }
.line {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
  font-size: 14px;
}
.line:last-child { border-bottom: 0; }
.line .l-name b { font-weight: 700; }
.line .l-sub { color: var(--text-dim); font-size: 12.5px; }
.line .l-amt { font-family: var(--font-display); font-weight: 700; white-space: nowrap; }

/* ── المساعد الصوتي ──────────────────────────────────────── */
.voice-layout { display: grid; gap: 18px; grid-template-columns: 1.15fr .85fr; }
@media (max-width: 880px) { .voice-layout { grid-template-columns: 1fr; } }

.voice-stage {
  background:
    radial-gradient(420px 280px at 50% -10%, rgba(239,138,43,.12), transparent 70%),
    var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}

/* زر المايك — العنصر المميّز (جمرة التنّور) */
.mic {
  --size: 138px;
  position: relative; width: var(--size); height: var(--size);
  border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 46px; color: #1a130b;
  background: radial-gradient(circle at 50% 32%, var(--ember-soft), var(--ember-deep) 78%);
  box-shadow: 0 16px 50px -14px var(--ember-glow), inset 0 2px 6px rgba(255,255,255,.3);
  transition: transform .15s;
}
.mic::before {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid var(--ember-glow); opacity: 0;
}
.mic:hover { transform: scale(1.03); }
.mic:active { transform: scale(.97); }
.mic.listening { animation: ember-breathe 1.1s ease-in-out infinite; }
.mic.listening::before { animation: ember-ring 1.4s ease-out infinite; }
.mic.thinking { animation: ember-spin 1s linear infinite; filter: saturate(.7); }
@keyframes ember-breathe {
  0%,100% { box-shadow: 0 16px 50px -14px var(--ember-glow), 0 0 0 0 var(--ember-glow), inset 0 2px 6px rgba(255,255,255,.3); }
  50%     { box-shadow: 0 16px 50px -14px var(--ember-glow), 0 0 0 18px transparent, inset 0 2px 6px rgba(255,255,255,.3); }
}
@keyframes ember-ring { 0% { opacity: .8; inset: -6px; } 100% { opacity: 0; inset: -30px; } }
@keyframes ember-spin { to { transform: rotate(360deg); } }

.mic-hint { font-size: 13.5px; color: var(--text-dim); text-align: center; min-height: 20px; }
.mic-hint b { color: var(--ember-soft); }

.voice-input { display: flex; gap: 8px; width: 100%; }
.voice-input input {
  flex: 1; font-family: var(--font-body); font-size: 14.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 14px; outline: none;
}
.voice-input input:focus { border-color: var(--ember); box-shadow: 0 0 0 3px var(--ember-glow); }

.transcript {
  width: 100%; display: flex; flex-direction: column; gap: 10px;
  max-height: 340px; overflow-y: auto; padding: 4px 2px;
}
.bubble {
  max-width: 82%; padding: 10px 14px; border-radius: 16px;
  font-size: 14px; line-height: 1.55; animation: rise .25s ease both;
}
.bubble.user {
  align-self: flex-start; background: var(--bg-4); color: var(--text);
  border-bottom-right-radius: 5px;
}
.bubble.bot {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--ember), var(--ember-deep));
  color: #1c1409; border-bottom-left-radius: 5px; font-weight: 500;
}
.empty-hint { color: var(--text-faint); font-size: 13px; text-align: center; padding: 30px 0; }

/* لوحة الطلب الحيّ */
.live-order { display: flex; flex-direction: column; }
.live-order .lo-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.live-order .lo-head h3 { font-family: var(--font-display); font-size: 16px; font-weight: 800; }
.live-order .lo-body { padding: 8px 18px; flex: 1; min-height: 120px; }
.live-order .lo-foot {
  padding: 15px 18px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.total-row {
  display: flex; align-items: baseline; justify-content: space-between;
}
.total-row .lbl { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.total-row .val { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--ember-soft); }
.total-row .val small { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.lo-actions { display: flex; gap: 8px; }
.lo-actions .btn { flex: 1; justify-content: center; }

.warn {
  font-size: 12.5px; color: var(--ember-soft); background: var(--amber-bg);
  border: 1px solid rgba(239,138,43,.3); border-radius: 10px; padding: 8px 12px;
}

/* ── النوافذ (Modal) ─────────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(8,6,4,.66); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 18px;
}
.modal-back.open { display: flex; animation: rise .2s ease; }
.modal {
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg-2);
}
.modal-head h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.x { appearance: none; border: 0; background: var(--bg-3); color: var(--text-dim);
     width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 18px; }
.x:hover { color: var(--text); background: var(--bg-4); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 16px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-start;
  position: sticky; bottom: 0; background: var(--bg-2);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 14.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 13px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ember); box-shadow: 0 0 0 3px var(--ember-glow);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ember); }
.addon-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.addon-pick label {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 13px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
}
.addon-pick label:has(input:checked) {
  border-color: var(--ember); color: var(--ember-soft); background: var(--amber-bg);
}
.addon-pick input { accent-color: var(--ember); }

/* ── حالات / تنبيهات ─────────────────────────────────────── */
.loading, .empty { text-align: center; color: var(--text-dim); padding: 50px 16px; }
.loading .spin {
  width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--ember);
  animation: ember-spin .8s linear infinite;
}
.toast-wrap {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 999px; padding: 11px 20px; box-shadow: var(--shadow);
  animation: rise .25s ease both;
}
.toast.ok  { border-color: rgba(95,164,99,.5);  color: #c6e8c8; }
.toast.err { border-color: rgba(209,73,47,.5);  color: #ffd4ca; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* تمرير مخصّص */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ember-deep); }
