/* Dijaja design system — shared by the store, the back office and the supplier portal.
   Layout idea: bright brand yellow carries campaign surfaces; white cards carry information; black type. */

@font-face { font-family: 'SKODA Next Arabic'; src: url('/assets/fonts/SKODANextArabic-Light.woff') format('woff'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'SKODA Next Arabic'; src: url('/assets/fonts/SKODANextArabic-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'SKODA Next Arabic'; src: url('/assets/fonts/SKODANextArabic-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'SKODA Next Arabic'; src: url('/assets/fonts/SKODANextArabic-Black.woff') format('woff'); font-weight: 900; font-display: swap; }

:root {
  --yolk: #FFC610;
  --sun: #FFA90D;
  --orange: #FC6215;
  --red: #FF1515;
  --ink: #000000;
  --paper: #FFFFFF;

  --ink-2: #2B2B2B;
  --ink-3: #6E6A64;
  --line: #E8E4DC;
  --wash: #F6F4EF;
  --sun-wash: #FFF6DE;

  --good: #128A4A;
  --warn: #B86A00;
  --bad: #D7261E;
  --info: #1F5FBF;

  --font: 'SKODA Next Arabic', 'Helvetica Neue', Tahoma, Arial, sans-serif;
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 8%), 0 16px 40px rgb(0 0 0 / 12%);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink);
  background: var(--paper); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 900; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, .money, td.n { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }

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

/* ───────── Buttons ───────── */
.btn {
  --bg: var(--ink); --fg: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--bg); color: var(--fg); font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn.is-busy::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-orange { --bg: var(--orange); --fg: var(--paper); }
.btn-yolk { --bg: var(--yolk); --fg: var(--ink); }
.btn-light { --bg: var(--paper); --fg: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-light:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-ghost { --bg: transparent; --fg: var(--ink); }
.btn-ghost:hover { --bg: var(--wash); box-shadow: none; }
.btn-danger { --bg: var(--bad); }
.btn-wa { --bg: #1FAF55; --fg: #fff; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 17px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; position: relative; color: inherit;
}
.icon-btn:hover { background: var(--wash); }
.icon-btn svg { width: 22px; height: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Forms ───────── */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(255 198 16 / 45%); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 13px; font-weight: 700; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 14px; padding-inline-start: 36px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: inset-inline-start .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { inset-inline-start: 21px; }

/* ───────── Chips & badges ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px;
  background: var(--wash); color: var(--ink-2); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.chip.good { background: #E3F4EA; color: var(--good); }
.chip.warn { background: #FFF1D6; color: var(--warn); }
.chip.bad { background: #FDE5E3; color: var(--bad); }
.chip.info { background: #E5EEFB; color: var(--info); }
.chip.muted { background: var(--wash); color: var(--ink-3); }
.chip.dark { background: var(--ink); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* Egg badges: the condition system */
.egg { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 12px; letter-spacing: .02em; line-height: 1; }
.egg svg { width: 18px; height: 22px; flex: none; }
.egg-pill { height: 28px; padding: 0 10px 0 12px; border-radius: 99px; background: var(--paper); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.egg-gold { color: #9A6A00; }
.egg-silver { color: #59606A; }
.egg-used { color: var(--orange); }
.eggs-row { display: inline-flex; gap: 2px; direction: ltr; }
.eggs-row svg { width: 16px; height: 20px; }

/* ───────── Surfaces ───────── */
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.muted { color: var(--ink-3); }
.empty { display: grid; place-items: center; gap: 14px; padding: 48px 16px; text-align: center; color: var(--ink-3); }
.empty img { width: 120px; height: auto; }
.skeleton { background: linear-gradient(90deg, var(--wash) 0, #efece5 40%, var(--wash) 80%) 0 0 / 300% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ───────── Overlays ───────── */
.toast-stack { position: fixed; inset-block-end: 20px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(520px, 100% - 32px); padding: 12px 18px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--shadow-lift); animation: rise .2s ease; }
.toast.bad { background: var(--bad); }
.toast.good { background: var(--good); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.modal-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); display: grid; place-items: center; padding: 16px; z-index: 900; animation: fade .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-lift); animation: rise .2s ease; }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; z-index: 1; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 22px; display: grid; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: inherit; }
@keyframes fade { from { opacity: 0; } }

.drawer-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 40%); z-index: 800; animation: fade .15s ease; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(440px, 100%); background: var(--paper); z-index: 801; display: flex; flex-direction: column; box-shadow: var(--shadow-lift); animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }

/* ───────── Tables ───────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--sun-wash); }
.table td.n, .table th.n { text-align: end; }
:where(svg[viewBox="0 0 20 24"]) { width: 14px; height: 17px; flex: none; }
.money, .num { white-space: nowrap; unicode-bidi: isolate; }
