/* ──────────────────────────────────────────────────────────────
   Khidma — Sudan Services & Transport
   Shared design tokens (MVP)
   Customer = deep teal · Provider = same hue, warm orange accent
   ────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* ── BRAND · DEEP TEAL ─────────────────────────────────── */
  --brand-50:  oklch(97% 0.018 195);     /* #E6F4F3 */
  --brand-100: oklch(93% 0.035 195);     /* #C9E8E6 */
  --brand-200: oklch(85% 0.060 195);     /* #97D3CF */
  --brand-300: oklch(72% 0.080 195);     /* #5BB5B0 */
  --brand-400: oklch(58% 0.085 195);     /* #2E938E */
  --brand-500: oklch(48% 0.075 195);     /* #006A6A — primary */
  --brand-600: oklch(40% 0.065 195);     /* #00524F */
  --brand-700: oklch(32% 0.055 195);     /* #00403D */
  --brand-800: oklch(24% 0.040 195);     /* #002E2C */
  --brand-900: oklch(16% 0.025 195);     /* #001D1B */

  /* ── CUSTOMER ACCENT · soft gold (warm pairing for teal) ── */
  --customer-accent: oklch(75% 0.12 85); /* #D4A445 */

  /* ── PROVIDER ACCENT · warm orange (work mode) ─────────── */
  --provider-50:  oklch(97% 0.018 50);
  --provider-100: oklch(91% 0.045 50);
  --provider-500: oklch(64% 0.155 45);   /* #D97757 — primary */
  --provider-600: oklch(55% 0.150 40);   /* #B9542F */
  --provider-700: oklch(45% 0.130 40);   /* #964224 */

  /* ── STATUS / SEMANTIC ─────────────────────────────────── */
  --success-50:  oklch(95% 0.035 145);
  --success-500: oklch(58% 0.130 145);   /* #2F8C4C */
  --success-700: oklch(40% 0.090 145);

  --warning-50:  oklch(96% 0.040 75);
  --warning-500: oklch(72% 0.145 75);    /* #D4933A */
  --warning-700: oklch(48% 0.105 75);

  --error-50:   oklch(96% 0.025 25);
  --error-500:  oklch(55% 0.190 25);     /* #C53030 */
  --error-700:  oklch(40% 0.150 25);

  --info-50:    oklch(96% 0.025 235);
  --info-500:   oklch(58% 0.130 235);    /* #3776C4 */
  --info-700:   oklch(40% 0.110 235);

  /* status badges use these dedicated tokens for the 5 order states */
  --state-pending-bg:    var(--warning-50);
  --state-pending-fg:    var(--warning-700);
  --state-pending-dot:   var(--warning-500);

  --state-accepted-bg:   var(--info-50);
  --state-accepted-fg:   var(--info-700);
  --state-accepted-dot:  var(--info-500);

  --state-otw-bg:        var(--brand-100);
  --state-otw-fg:        var(--brand-700);
  --state-otw-dot:       var(--brand-500);

  --state-completed-bg:  var(--success-50);
  --state-completed-fg:  var(--success-700);
  --state-completed-dot: var(--success-500);

  --state-cancelled-bg:  oklch(94% 0.005 240);
  --state-cancelled-fg:  oklch(40% 0.010 240);
  --state-cancelled-dot: oklch(60% 0.010 240);

  /* ── NEUTRALS (warm-leaning) ───────────────────────────── */
  --gray-50:  oklch(98.5% 0.003 195);    /* page background */
  --gray-100: oklch(96.5% 0.005 195);    /* subtle surface */
  --gray-150: oklch(94% 0.006 195);
  --gray-200: oklch(90% 0.006 195);      /* borders */
  --gray-300: oklch(82% 0.007 195);      /* dividers, disabled */
  --gray-400: oklch(65% 0.008 195);      /* placeholder, hint */
  --gray-500: oklch(50% 0.008 195);      /* muted text */
  --gray-600: oklch(38% 0.008 195);      /* secondary text */
  --gray-700: oklch(28% 0.008 195);      /* body */
  --gray-800: oklch(20% 0.008 195);      /* headings */
  --gray-900: oklch(12% 0.008 195);      /* display */

  /* ── ROLE TOKENS (consumed by components) ──────────────── */
  --bg:           var(--gray-50);
  --surface:      #ffffff;
  --surface-2:    var(--gray-100);
  --border:       var(--gray-200);
  --border-strong:var(--gray-300);
  --text:         var(--gray-800);
  --text-muted:   var(--gray-500);
  --text-hint:    var(--gray-400);
  --text-on-brand:#ffffff;

  --primary:      var(--brand-500);
  --primary-dark: var(--brand-600);
  --primary-soft: var(--brand-50);

  /* ── TYPOGRAPHY ────────────────────────────────────────── */
  --font-ar:    'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-en:    'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* Material 3 — slightly tightened type scale */
  --t-display:   34px;   --t-display-lh:   42px;
  --t-headline:  26px;   --t-headline-lh:  34px;
  --t-title-lg:  22px;   --t-title-lg-lh:  30px;
  --t-title:     18px;   --t-title-lh:     26px;
  --t-body-lg:   16px;   --t-body-lg-lh:   24px;
  --t-body:      14px;   --t-body-lh:      20px;
  --t-label:     13px;   --t-label-lh:     18px;
  --t-caption:   12px;   --t-caption-lh:   16px;
  --t-overline:  11px;   --t-overline-lh:  14px;

  /* ── SPACING (4-step) ──────────────────────────────────── */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10:56px;
  --s-11:64px;

  /* ── RADII ─────────────────────────────────────────────── */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ── ELEVATION (warm, low-key) ─────────────────────────── */
  --shadow-1: 0 1px 2px rgba(0, 30, 28, 0.05),
              0 1px 1px rgba(0, 30, 28, 0.04);
  --shadow-2: 0 4px 12px -2px rgba(0, 30, 28, 0.08),
              0 2px 4px -2px rgba(0, 30, 28, 0.05);
  --shadow-3: 0 12px 28px -8px rgba(0, 30, 28, 0.14),
              0 6px 12px -6px rgba(0, 30, 28, 0.08);
  --shadow-focus: 0 0 0 3px oklch(72% 0.080 195 / 0.35);

  /* ── MOTION ────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 360ms;

  /* ── LAYOUT ────────────────────────────────────────────── */
  --hit-min: 48px;       /* Android touch target floor */
  --gutter:  20px;
  --safe-bot: 16px;
}

/* RTL Arabic shell — applied by each screen via <html dir="rtl" lang="ar"> */
html[lang="ar"] { font-family: var(--font-ar); }
html[lang="en"] { font-family: var(--font-en); }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'ss01' 1;
}

body {
  font-family: var(--font-ar);
  font-size: var(--t-body-lg);
  line-height: var(--t-body-lg-lh);
}

img, svg { display: block; }

/* ─── SCREEN SHELL (412 × ~836) ─────────────────────────── */
.screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.screen.scroll { overflow-y: auto; }

.app-bar {
  flex: 0 0 auto;
  height: 56px;
  padding: 0 var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--surface);
}
.app-bar.transparent { background: transparent; }
.app-bar .title {
  font-size: var(--t-title);
  line-height: var(--t-title-lh);
  font-weight: 600;
  color: var(--text);
}
.app-bar .icon-btn { margin-inline-start: -8px; }

.app-bar-back {
  width: var(--hit-min); height: var(--hit-min);
  border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center;
  color: var(--text);
  margin-inline-start: -12px;
}
.app-bar-back svg { width: 24px; height: 24px; }
html[dir="rtl"] .app-bar-back svg { transform: scaleX(-1); }

.content {
  flex: 1 1 auto;
  padding: var(--s-5) var(--gutter);
}

.bottom-actions {
  flex: 0 0 auto;
  padding: var(--s-4) var(--gutter) calc(var(--s-5) + var(--safe-bot));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* ─── TYPOGRAPHY HELPERS ────────────────────────────────── */
.t-display  { font-size: var(--t-display);  line-height: var(--t-display-lh);  font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.t-headline { font-size: var(--t-headline); line-height: var(--t-headline-lh); font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.t-title-lg { font-size: var(--t-title-lg); line-height: var(--t-title-lg-lh); font-weight: 600; color: var(--text); }
.t-title    { font-size: var(--t-title);    line-height: var(--t-title-lh);    font-weight: 600; color: var(--text); }
.t-body-lg  { font-size: var(--t-body-lg);  line-height: var(--t-body-lg-lh);  font-weight: 400; color: var(--text); }
.t-body     { font-size: var(--t-body);     line-height: var(--t-body-lh);     font-weight: 400; color: var(--text); }
.t-label    { font-size: var(--t-label);    line-height: var(--t-label-lh);    font-weight: 500; color: var(--text); }
.t-caption  { font-size: var(--t-caption);  line-height: var(--t-caption-lh);  font-weight: 400; color: var(--text-muted); }
.t-overline { font-size: var(--t-overline); line-height: var(--t-overline-lh); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.hint  { color: var(--text-hint); }
.num   { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.latin { font-family: var(--font-en); }
.mono  { font-family: var(--font-mono); }

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn {
  --bg: var(--primary);
  --fg: var(--text-on-brand);
  --bd: transparent;
  min-height: var(--hit-min);
  padding: 0 var(--s-5);
  border-radius: var(--r-md);
  border: 1px solid var(--bd);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--t-body-lg);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  transition: background var(--dur-1) var(--ease-out),
              transform var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.lg   { min-height: 56px; font-size: 17px; }

.btn-primary       { --bg: var(--primary); --fg: var(--text-on-brand); }
.btn-primary:hover { --bg: var(--primary-dark); }

.btn-secondary       { --bg: var(--primary-soft); --fg: var(--brand-700); }
.btn-secondary:hover { --bg: var(--brand-100); }

.btn-tertiary        { --bg: transparent; --fg: var(--brand-600); }
.btn-tertiary:hover  { --bg: var(--brand-50); }

.btn-outline         { --bg: var(--surface); --fg: var(--text); --bd: var(--border-strong); }
.btn-outline:hover   { --bg: var(--gray-100); }

.btn-destructive       { --bg: var(--error-500); --fg: #fff; }
.btn-destructive:hover { --bg: var(--error-700); }

.btn-icon {
  min-height: 0;
  width: var(--hit-min); height: var(--hit-min);
  padding: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text);
  border: 0;
}
.btn-icon:hover { background: var(--gray-100); }
.btn-icon svg { width: 22px; height: 22px; }

/* ─── TEXT FIELDS ───────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.field-label {
  font-size: var(--t-label);
  line-height: var(--t-label-lh);
  font-weight: 500;
  color: var(--gray-700);
}
.field-input {
  height: 56px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--t-body-lg);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  transition: border-color var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out);
}
.field-input:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.field-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
}
.field-input input::placeholder { color: var(--text-hint); }
.field-help { font-size: var(--t-caption); line-height: var(--t-caption-lh); color: var(--text-muted); }
.field-error { color: var(--error-700); }
.field.error .field-input { border-color: var(--error-500); }

/* phone-input variant — Latin numerals, prefix chip */
.field-input.phone {
  flex-direction: row-reverse; /* prefix always on the LEFT visually, even in RTL */
}
html[dir="rtl"] .field-input.phone { flex-direction: row-reverse; }
.phone-prefix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-inline-end: var(--s-3);
  border-inline-end: 1px solid var(--border);
  height: 32px;
  font-family: var(--font-en);
  font-weight: 500;
  color: var(--gray-700);
  flex-shrink: 0;
  direction: ltr;
}
.phone-prefix .flag {
  width: 22px; height: 16px;
  border-radius: 2px;
  overflow: hidden;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.field-input.phone input {
  font-family: var(--font-en);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: start;
}

/* ─── STATUS BADGES ─────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 10px;
  border-radius: var(--r-pill);
  font-size: var(--t-caption);
  line-height: 1;
  font-weight: 600;
  height: 24px;
}
.status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status.pending   { background: var(--state-pending-bg);   color: var(--state-pending-fg); }
.status.pending   .dot { background: var(--state-pending-dot);   animation: pulse 1.4s ease-in-out infinite; }
.status.accepted  { background: var(--state-accepted-bg);  color: var(--state-accepted-fg); }
.status.accepted  .dot { background: var(--state-accepted-dot); }
.status.otw       { background: var(--state-otw-bg);       color: var(--state-otw-fg); }
.status.otw       .dot { background: var(--state-otw-dot); animation: pulse 1.4s ease-in-out infinite; }
.status.completed { background: var(--state-completed-bg); color: var(--state-completed-fg); }
.status.completed .dot { background: var(--state-completed-dot); }
.status.cancelled { background: var(--state-cancelled-bg); color: var(--state-cancelled-fg); }
.status.cancelled .dot { background: var(--state-cancelled-dot); }

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%      { transform: scale(1.4); opacity: 0.55;}
}

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
}
.card.flat { border: 0; background: var(--gray-100); }
.card.elev { box-shadow: var(--shadow-2); border-color: transparent; }

/* ─── AVATARS ───────────────────────────────────────────── */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }

/* ─── DIVIDERS ──────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); border: 0; }

/* ─── DOTS / PAGINATION ─────────────────────────────────── */
.dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.dots .d {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: all var(--dur-2) var(--ease-out);
}
.dots .d.active {
  width: 22px;
  border-radius: 3px;
  background: var(--primary);
}

/* ─── PROGRESS BAR ──────────────────────────────────────── */
.linear-progress {
  height: 3px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.linear-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--primary);
  border-radius: inherit;
  animation: lp 1.4s infinite var(--ease-out);
}
@keyframes lp {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(280%);  }
}
html[dir="rtl"] .linear-progress::after { animation-direction: reverse; }

/* ─── SKELETON ──────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-150) 50%, var(--gray-100) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skel 1.4s linear infinite;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── UTILS ─────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--s-3); }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.between { justify-content: space-between; }
.center { justify-content: center; align-items: center; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.mt-1{margin-top:var(--s-1)}.mt-2{margin-top:var(--s-2)}.mt-3{margin-top:var(--s-3)}.mt-4{margin-top:var(--s-4)}.mt-5{margin-top:var(--s-5)}.mt-6{margin-top:var(--s-6)}.mt-7{margin-top:var(--s-7)}.mt-8{margin-top:var(--s-8)}
.text-center{text-align:center}

/* a tiny annotation chip used on review screens — kept inside artifacts, not on product surface */
.dev-note {
  position: absolute;
  inset-inline-start: 8px;
  bottom: 8px;
  background: rgba(0, 30, 28, 0.85);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-en);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
}
