/* =====================================================
   Loyalty & Menu Core — Design System
   كحلي + ذهبي. غيّر المتغيرات في :root فقط لتغيير الهوية كاملة.
   ===================================================== */
@import url('./fonts/fonts.css');

:root {
  /* الهوية (طابقها مع موقعك) */
  --navy-950: #040C1F;
  --navy-900: #081430;
  --navy-800: #0D1D42;
  --navy-700: #142A58;
  --navy-600: #1D3A74;
  --gold-600: #A98532;
  --gold-500: #C9A24B;
  --gold-400: #DAB966;
  --gold-300: #E9D3A0;

  /* لون البراند (يتغير تلقائياً من brand.js) */
  --accent-rgb: 201 162 75;
  --accent-light-rgb: 233 211 160;
  --on-accent: #040C1F;

  /* محايدات */
  --ink: #F5F2EA;
  --ink-soft: #C9CFDD;
  --muted: #8C9AB8;
  --line: rgb(var(--accent-rgb) / .16);
  --line-soft: rgba(255, 255, 255, .07);

  /* حالات */
  --success: #3FBF8F;
  --danger: #E5646F;

  /* أبعاد */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 85% -10%, rgb(var(--accent-rgb) / .10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(29,58,116,.45), transparent 60%),
    var(--navy-950);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font-family: inherit; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.icon { width: 18px; height: 18px; stroke-width: 1.8; flex-shrink: 0; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */
.app { width: 100%; max-width: 460px; margin: 0 auto; padding: 16px 16px 40px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500) 55%, var(--gold-600));
  box-shadow: 0 4px 14px rgb(var(--accent-rgb) / .3);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-mark.has-logo { background: rgba(255,255,255,.06); box-shadow: none; border: 1px solid var(--line-soft); }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); }

/* ---------- Surfaces ---------- */
.card {
  background: linear-gradient(180deg, rgba(20,42,88,.55), rgba(13,29,66,.55));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(8px);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-gold {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500) 60%, var(--gold-600));
  box-shadow: 0 6px 20px rgb(var(--accent-rgb) / .25);
}
.btn-gold:hover { box-shadow: 0 8px 26px rgb(var(--accent-rgb) / .4); }
.btn-outline { border: 1px solid var(--line); color: var(--gold-300); background: rgb(var(--accent-rgb) / .06); }
.btn-outline:hover { background: rgb(var(--accent-rgb) / .12); border-color: var(--gold-500); }
.btn-ghost { color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); background: var(--line-soft); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Inputs ---------- */
.input {
  width: 100%; height: 54px; padding: 0 16px; border-radius: var(--radius);
  background: rgba(4,12,31,.6); border: 1px solid var(--line-soft);
  color: var(--ink); font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: #5C6C8F; }
.input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 4px rgb(var(--accent-rgb) / .12); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-inline-start: 42px; height: 46px; font-size: 14px; }

/* ---------- Chips / Badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink-soft);
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.03); transition: all .2s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--line); }
.chip.active { color: var(--on-accent); background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); border-color: transparent; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-gold { color: var(--gold-300); background: rgb(var(--accent-rgb) / .12); border: 1px solid var(--line); }
.badge-ok { color: var(--success); background: rgba(63,191,143,.1); border: 1px solid rgba(63,191,143,.25); }
.badge-muted { color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line-soft); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); transition: width .9s var(--ease); }
.progress.ok > span { background: linear-gradient(90deg, #2c9c72, var(--success)); }

/* ---------- Toast ---------- */
#toast-host { position: fixed; top: 14px; inset-inline: 14px; z-index: 500; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 440px; width: 100%; padding: 13px 16px;
  border-radius: var(--radius); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow);
  background: var(--navy-800); border: 1px solid var(--line); animation: toast-in .35s var(--ease);
}
.toast.ok { border-color: rgba(63,191,143,.4); } .toast.ok .icon { color: var(--success); }
.toast.err { border-color: rgba(229,100,111,.45); } .toast.err .icon { color: var(--danger); }
.toast.out { animation: toast-out .25s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Bottom Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(2,6,16,.72); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 90; max-width: 520px; margin: 0 auto;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px 20px 28px; max-height: 90vh; overflow-y: auto;
  transform: translateY(105%); transition: transform .35s var(--ease);
}
.sheet.open { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); margin: 0 auto 16px; }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.05); border-radius: var(--radius); }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Motion ---------- */
.fade-up { animation: fade-up .5s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 32px 12px; color: var(--muted); font-size: 13.5px; }
.empty .icon { width: 36px; height: 36px; margin: 0 auto 10px; display: block; color: var(--navy-600); }

/* ---------- Footer ---------- */
.foot { text-align: center; font-size: 12px; color: #55658A; padding-top: 18px; }

/* خانات الأرقام بلا أسهم زيادة/نقصان */
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
