/* ============================================================
 *  تنسيق موقع حجوزات حلويات مزن — مشترك بين صفحة المحل وصفحة العميل
 * ============================================================ */

:root {
  --bg:        #fbf6f1;
  --card:      #ffffff;
  --ink:       #3a2a2a;
  --muted:     #8b7770;
  --line:      #ecdfd4;
  --rose:      #b23a63;
  --rose-soft: #fdeaf1;
  --gold:      #b6801f;
  --gold-soft: #fbf0d8;
  --green:     #1c7a54;
  --green-soft:#e2f4ec;
  --blue:      #2c6aa8;
  --blue-soft: #e6f0fa;
  --red:       #b3352f;
  --red-soft:  #fbe6e5;
  --gray-soft: #eeeae6;
  --shadow:    0 2px 10px rgba(90, 60, 45, .07);
  --radius:    16px;
}

* { box-sizing: border-box; }

/* لازم قبل أي قاعدة display لاحقة، وإلا ظهرت الأزرار المخفية */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

/* الأرقام دائماً إنجليزية (1 2 3) لا هندية (١ ٢ ٣) */
body { font-variant-numeric: lining-nums; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 14px 60px; }

/* ---------- الترويسة ---------- */
.top {
  background: linear-gradient(135deg, #7d2545, #b23a63);
  color: #fff;
  padding: 18px 14px;
  box-shadow: var(--shadow);
}
.top-in {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.brand { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -.2px; }
.brand small { display: block; font-size: 13px; font-weight: 500; opacity: .85; letter-spacing: 0; }
.top .spacer { flex: 1 1 auto; }

/* ---------- الأزرار ---------- */
button, .btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: filter .15s, transform .05s;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--rose); color: #fff; }
.btn-ghost   { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-line    { background: var(--card); border-color: var(--line); }
.btn-wa      { background: #25d366; color: #08321a; }
.btn-danger  { background: var(--red-soft); color: var(--red); border-color: #f0c9c7; }
.btn-sm      { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
button:hover:not(:disabled), .btn:hover { filter: brightness(.97); }

/* ---------- البطاقات ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px 0;
}
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card h2 .hint { font-weight: 500; font-size: 13px; color: var(--muted); }

/* ---------- الحقول ---------- */
label.field { display: block; margin: 0 0 14px; }
label.field > span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #6b544e;
}
label.field .req { color: var(--rose); }
input[type=text], input[type=tel], input[type=date], input[type=time],
input[type=password], input[type=search], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fffdfb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--rose-soft);
  border-color: var(--rose);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.help { font-size: 13px; color: var(--muted); margin: -8px 0 12px; }

/* حقول التاريخ والوقت: نُبقيها بالاتجاه الإنجليزي حتى تظهر أرقامها 1 2 3 */
input[type=date], input[type=time] { direction: ltr; text-align: right; }

/* ---------- وسوم الحالة ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}
.chip-new       { background: var(--gold-soft);  color: var(--gold); }
.chip-preparing { background: var(--blue-soft);  color: var(--blue); }
.chip-ready     { background: var(--green-soft); color: var(--green); }
.chip-delivered { background: var(--gray-soft);  color: #6a5a52; }
.chip-canceled  { background: var(--red-soft);   color: var(--red); }
.chip-warn      { background: var(--rose-soft);  color: var(--rose); }

/* ---------- قائمة الطلبات ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filters button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
}
.filters button[aria-pressed="true"] { background: var(--rose); color: #fff; border-color: var(--rose); }

.order-row {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: right;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 10px;
  font-weight: 500;
}
.order-row .thumb {
  width: 58px; height: 58px; flex: 0 0 58px;
  border-radius: 12px; object-fit: cover; background: var(--gray-soft);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.order-row .grow { flex: 1 1 auto; min-width: 0; }
.order-row .name { font-weight: 800; font-size: 16px; }
.order-row .meta { font-size: 13px; color: var(--muted); }
.order-row .no { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- الأصناف (صورة + وصف) ---------- */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fffdfb;
  display: flex;
  flex-direction: column;
}
.item .ph { position: relative; background: var(--gray-soft); }
.item .ph img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.item .num {
  position: absolute; inset-inline-start: 8px; top: 8px;
  background: rgba(0,0,0,.6); color: #fff;
  border-radius: 999px; font-size: 12px; font-weight: 700; padding: 2px 9px;
}
.item .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.item .desc { white-space: pre-wrap; font-size: 15px; }
.item .qty { font-size: 13px; font-weight: 800; color: var(--rose); }
.item .tools { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- الخط الزمني للتحديثات ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 24px 16px 0;
  padding-inline: 24px 0;
}
.timeline li::before {
  content: "";
  position: absolute; inset-inline-start: 0; top: 9px;
  width: 11px; height: 11px;
  border-radius: 50%; background: var(--rose);
}
.timeline li::after {
  content: "";
  position: absolute; inset-inline-start: 4.5px;
  top: 20px; bottom: 0; width: 2px;
  background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .what { font-weight: 700; }

/* ---------- متفرقات ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.toast {
  position: fixed; inset-inline: 0; bottom: 18px; margin: 0 auto;
  width: max-content; max-width: 90%;
  background: #2f2321; color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 50; opacity: 0; transform: translateY(10px);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast.bad { background: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sticky-save {
  position: sticky; bottom: 0; z-index: 5;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
  padding: 12px 0 8px; display: flex; gap: 8px; flex-wrap: wrap;
}
.spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* عارض الصورة بالحجم الكامل */
.lightbox {
  position: fixed; inset: 0; background: rgba(25,15,12,.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* ---------- الطباعة ---------- */
@media print {
  .top { background: none; color: #000; box-shadow: none; border-bottom: 2px solid #000; }
  .no-print, .sticky-save, .filters, .toast { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  .items { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- شريط مراحل الطلب (صفحة العميل) ---------- */
.steps { display: flex; gap: 4px; }
.step { flex: 1 1 0; text-align: center; position: relative; }
.step .dot {
  width: 30px; height: 30px; margin: 0 auto 6px;
  border-radius: 50%; background: var(--gray-soft); color: #9a8880;
  font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
}
.step .lbl { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.step.done .dot { background: var(--green-soft); color: var(--green); }
.step.done .lbl { color: var(--green); }
.step.now  .dot { background: var(--rose); color: #fff; box-shadow: 0 0 0 4px var(--rose-soft); }
.step.now  .lbl { color: var(--rose); }
/* الخط الواصل بين المراحل */
.step::before {
  content: ""; position: absolute; top: 15px; height: 3px;
  background: var(--line); inset-inline-start: 50%; width: 100%;
}
.step:last-child::before { display: none; }
.step.done::before { background: var(--green-soft); }
