/* ============================================================
   سوق النقاط — نظام التصميم المشترك
   الهوية الرسمية من ملف الشعار:
   كحلي #19477A · فيروزي #199BB4 · برتقالي #E28A25
   (أسماء المتغيرات: night=الكحلي، brass=البرتقالي، cream=الخلفية)
   ============================================================ */

:root {
  /* الألوان */
  --night: #19477a;        /* الكحلي الأساسي */
  --night-deep: #0e2c4f;
  --night-soft: #199bb4;   /* الفيروزي */
  --teal: #199bb4;
  --teal-soft: #ddf0f4;
  --brass: #e28a25;        /* البرتقالي النحاسي */
  --brass-bright: #f2a93b;
  --brass-pale: #fbe8cd;
  --coral: #c4553b;        /* خطأ / إلغاء */
  --coral-soft: #f5ded6;
  --cream: #f4f8fa;        /* خلفية الورق */
  --cream-2: #e7eef3;
  --line: #d6e1e9;
  --ink: #21374e;
  --ink-soft: #5b7185;
  --mint: #2f9c74;         /* نجاح */
  --mint-soft: #dcefe6;

  /* الخطوط */
  --font-display: "Sakkal Majalla", "Traditional Arabic", "Segoe UI", serif;
  --font-body: "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-num: "Cascadia Mono", Consolas, "Segoe UI", monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(14, 44, 79, 0.06), 0 6px 18px rgba(14, 44, 79, 0.07);
  --shadow-lg: 0 14px 44px rgba(14, 44, 79, 0.16), 0 3px 10px rgba(14, 44, 79, 0.08);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
a { color: var(--night); }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--night);
}

/* ---------------- مظلّة السوق (الترويسة المميزة) ---------------- */

.awning {
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 0 2px,
      transparent 2px 26px),
    linear-gradient(180deg, #1d5391, var(--night) 75%);
  border-bottom: 3px solid var(--brass);
  position: relative;
  color: #f4f8fa;
}
.awning::after {
  /* حافة المظلة المقوّسة */
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -10px;
  height: 10px;
  background:
    radial-gradient(circle at 9px -4px, transparent 8px, var(--night) 8.6px);
  background-size: 18px 10px;
  background-repeat: repeat-x;
  pointer-events: none;
  z-index: 5;
}

/* ---------------- عملة النقاط ---------------- */

.coin {
  display: inline-block;
  width: 1.05em; height: 1.05em;
  vertical-align: -0.16em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffd9a0 0%, var(--brass-bright) 42%, var(--brass) 78%, #9c5a12 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(156, 90, 18, 0.85),
    inset 0 0 0 3px rgba(255, 226, 178, 0.55),
    0 1px 2px rgba(0,0,0,0.25);
  position: relative;
  flex: none;
}
.coin::before {
  content: "★";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 0.52em;
  color: #8a4d0e;
  text-shadow: 0 1px 0 rgba(255, 226, 178, 0.8);
}

.pts {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-family: var(--font-num);
  font-weight: 700;
  white-space: nowrap;
}

@keyframes coin-pop {
  0% { transform: scale(1) rotateY(0deg); }
  50% { transform: scale(1.35) rotateY(180deg); }
  100% { transform: scale(1) rotateY(360deg); }
}
.coin.flip { animation: coin-pop 0.7s ease; }

/* ---------------- أزرار ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6em 1.3em;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 3px solid var(--brass-bright); outline-offset: 2px; }

.btn-brass {
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  color: #3d2506;
  box-shadow: 0 6px 16px rgba(226, 138, 37, 0.35);
}
.btn-brass:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(226, 138, 37, 0.45); }

.btn-night { background: var(--night); color: var(--cream); box-shadow: var(--shadow); }
.btn-night:hover { background: var(--night-soft); }

.btn-ghost {
  background: transparent;
  color: var(--night);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--cream-2); }

.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { filter: brightness(1.08); }

.btn-sm { font-size: 0.86rem; padding: 0.35em 0.9em; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------------- بطاقات وحقول ---------------- */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 0.3em; margin-bottom: 0.9em; }
.field > label { font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55em 0.8em;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(242, 169, 59, 0.28);
}
textarea { resize: vertical; min-height: 70px; }

/* ---------------- شارات وحالات ---------------- */

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1em 0.75em;
  white-space: nowrap;
}
.badge-pending { background: var(--brass-pale); color: #8a4d0e; }
.badge-delivered { background: var(--mint-soft); color: var(--mint); }
.badge-canceled { background: var(--coral-soft); color: var(--coral); }
.badge-quality { background: var(--cream-2); color: var(--ink-soft); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.32em 1em;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--brass); }
.chip.on {
  background: var(--night);
  border-color: var(--night);
  color: var(--cream);
}

/* ---------------- نوافذ منبثقة ---------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14, 44, 79, 0.6);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 16px;
  z-index: 100;
  animation: fade-in 0.18s ease;
}
.modal {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
  animation: rise-in 0.22s ease;
}
.modal.wide { max-width: 720px; }
.modal h3 { font-size: 1.5rem; margin-bottom: 0.5em; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------------- تنبيهات ---------------- */

#toast-zone {
  position: fixed;
  bottom: 18px;
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--night);
  color: var(--cream);
  border-radius: 999px;
  padding: 0.55em 1.4em;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: rise-in 0.25s ease;
  max-width: 92vw;
}
.toast.err { background: var(--coral); color: #fff; }
.toast.ok { background: var(--mint); color: #fff; }

/* ---------------- جداول ---------------- */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tbl th {
  text-align: right;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 0.5em 0.7em;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 0.55em 0.7em; border-bottom: 1px solid var(--cream-2); vertical-align: middle; }
.tbl tr:hover td { background: rgba(226, 138, 37, 0.07); }

/* ---------------- عناصر مساعدة ---------------- */

.muted { color: var(--ink-soft); font-size: 0.88rem; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
