/* ============================================================
   نظام ندى — Nada's System
   Calm, clinical, Arabic-first (RTL) design tokens & components
   ============================================================ */

:root {
  /* Nutrition Vibes palette — sampled directly from the logo */
  /* --teal* names retained as the PRIMARY (forest green) token slots */
  --teal:        #2F5E30;  /* deep forest green — from logo wordmark */
  --teal-600:    #28522a;
  --teal-700:    #1f4421;  /* darker forest — text on tint */
  --teal-tint:   #e7efe0;  /* soft green-cream tint */
  --teal-tint-2: #f1f5ea;
  --mint:        #d7e6c6;

  /* Fruit / brand accents — sampled from the logo */
  --leaf:    #7AAE33;  /* fresh lime-leaf green — from logo leaves */
  --apple:   #C8392F;  /* apple red — from logo apple */
  --carrot:  #EA6A22;  /* carrot orange — from logo carrot */
  --banana:  #F2C12E;  /* banana yellow — from logo banana */
  --olive:   #8C8A45;  /* olive/gold — from logo mid-greens */

  /* Surfaces */
  --bg:        #f7f6f1;  /* warm cream */
  --bg-2:      #eef0e6;
  --card:      #ffffff;
  --line:      #e9e8dd;
  --line-2:    #dcdccd;

  /* Ink */
  --ink:    #3a3f3c;  /* soft slate */
  --ink-2:  #5e635d;
  --ink-3:  #8d918a;

  /* Status */
  --green:      #7AAE33;  /* fresh leaf — active/success */
  --green-tint: #ecf2dd;
  --amber:      #EA6A22;  /* carrot — nearing end */
  --amber-tint: #fbe9dc;
  --red:        #C8392F;  /* apple — finished/expired */
  --red-tint:   #f8e3e1;
  --grey:       #9a9d93;  /* paused */
  --grey-tint:  #eef0e8;

  /* Shape */
  --r-card: 22px;
  --r-sm:   14px;
  --r-btn:  14px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20,55,48,.05), 0 1px 3px rgba(20,55,48,.04);
  --shadow-md: 0 6px 22px rgba(20,55,48,.07);
  --shadow-lg: 0 14px 50px rgba(20,55,48,.12);
  --ring: 0 0 0 4px rgba(47,158,143,.16);

  /* Typography (overridable by Tweaks) */
  --font: "Tajawal", system-ui, sans-serif;

  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { line-height: 1.6; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; color: var(--teal); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--teal-tint); }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------- App scaffold ---------- */
#root { min-height: 100vh; }
.fade-in { animation: fade .45s cubic-bezier(.2,.7,.3,1) both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; cursor: pointer; font-weight: 700; font-size: 15px;
  padding: 12px 22px; border-radius: var(--r-btn);
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 6px 16px rgba(47,158,143,.26); }
.btn-primary:hover { background: var(--teal-600); box-shadow: 0 8px 22px rgba(47,158,143,.34); }

.btn-secondary { background: #fff; color: var(--teal-700); border: 1.5px solid var(--line-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal-700); background: var(--teal-tint-2); }

.btn-ghost { background: transparent; color: var(--ink-2); padding: 10px 14px; }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }

.btn-soft { background: var(--teal-tint); color: var(--teal-700); }
.btn-soft:hover { background: var(--mint); }

.btn-lg { padding: 16px 30px; font-size: 17px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 15px; font-size: 13.5px; border-radius: 11px; }

.btn-green { background: var(--green); color:#fff; }
.btn-green:hover { background: var(--teal-600); }
.btn-danger-soft { background: var(--grey-tint); color: var(--ink-2); }
.btn-danger-soft:hover { background: #e3e9e7; color: var(--ink); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.card-pad { padding: 24px; }
.card-hover { transition: transform .15s ease, box-shadow .2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   Status pills
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-tint); color: #4d7a26; }
.pill-amber { background: var(--amber-tint); color: #9a6c14; }
.pill-red   { background: var(--red-tint);   color: #b1473e; }
.pill-grey  { background: var(--grey-tint);  color: #62736e; }

/* ============================================================
   Big numbers
   ============================================================ */
.bignum { font-weight: 800; letter-spacing: -0.03em; line-height: .95; color: var(--ink); }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input, .textarea, select.input {
  width: 100%; border: 1.5px solid var(--line-2); background: #fff;
  border-radius: var(--r-sm); padding: 13px 16px; font: inherit; font-size: 15px;
  color: var(--ink); transition: border-color .15s, box-shadow .15s; outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, select.input:focus { border-color: var(--teal); box-shadow: var(--ring); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.7; }

.search {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--r-pill);
  padding: 11px 18px; transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--teal); box-shadow: var(--ring); }
.search input { border: none; outline: none; background: transparent; font: inherit; font-size: 15px; width: 100%; color: var(--ink); }
.search svg { width: 19px; height: 19px; color: var(--ink-3); flex: none; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 9px 16px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600;
  background: #fff; color: var(--ink-2); border: 1.5px solid var(--line-2);
  transition: all .15s;
}
.chip:hover { border-color: var(--teal); color: var(--teal-700); }
.chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ============================================================
   Star rating
   ============================================================ */
.stars { display: inline-flex; gap: 3px; }
.stars svg { width: 18px; height: 18px; }
.star-on { color: #e6b450; }
.star-off { color: #dde6e3; }
.stars-input svg { width: 30px; height: 30px; cursor: pointer; transition: transform .1s; }
.stars-input svg:hover { transform: scale(1.12); }

/* ============================================================
   Placeholder media
   ============================================================ */
.ph {
  position: relative; overflow: hidden; border-radius: var(--r-card);
  background-color: var(--teal-tint-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgba(47,158,143,.06) 14px 28px);
  display: flex; align-items: center; justify-content: center;
  color: var(--teal-700); border: 1px dashed var(--line-2);
}
.ph span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; letter-spacing: .02em; opacity: .8; background: rgba(255,255,255,.7); padding: 5px 11px; border-radius: 8px; }
.ph-circle { border-radius: 50%; }

/* ============================================================
   Logo
   ============================================================ */
.logo { display: inline-flex; align-items: center; gap: 11px; direction: ltr; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--teal-tint); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 26px; height: 26px; }
.logo-word { font-weight: 800; font-size: 19px; color: var(--ink); letter-spacing: -0.01em; }
.logo-word b { color: var(--teal); font-weight: 800; }

/* Nutrition Vibes wordmark (Latin, engraved caps) */
.nv-word { display: flex; flex-direction: column; line-height: 1; }
.nv-word .nv-main { font-family: "Cinzel", serif; font-weight: 600; font-size: 19px; letter-spacing: .14em; color: var(--teal); text-transform: uppercase; }
.nv-word .nv-sub { font-family: "Cinzel", serif; font-size: 10px; font-weight: 500; color: var(--olive); letter-spacing: .14em; margin-top: 4px; text-transform: uppercase; }
.nv-emblem { width: 42px; height: 42px; flex: none; object-fit: contain; }
.nv-lockup { display: block; height: auto; }

/* trust strip */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--teal); border-radius: var(--r-card); overflow: hidden; }
.trust > div { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 18px 16px; color: #fff; font-weight: 700; font-size: 15px; text-align: center; border-inline-start: 1px solid rgba(255,255,255,.16); }
.trust > div:first-child { border-inline-start: none; }
.trust svg { width: 20px; height: 20px; color: var(--banana); flex: none; }

/* full-bleed hero (mode = "full") */
.hero-full { position: relative; border-radius: var(--r-card); overflow: hidden; min-height: 540px; }
.hero-full-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-full-scrim { position: absolute; inset: 0; background: linear-gradient(to right, rgba(247,246,241,.92) 0%, rgba(247,246,241,.58) 16%, rgba(247,246,241,.1) 34%, rgba(247,246,241,0) 46%); }
.hero-full-flex { position: relative; display: flex; min-height: 540px; align-items: center; }
.hero-full-text { max-width: 560px; padding: 56px; margin-inline-start: auto; }

/* social links (footer) */
.social-link { display: flex; align-items: center; gap: 13px; padding: 9px 12px; border-radius: 13px; transition: background .15s; }
.social-link:hover { background: var(--bg); }
.social-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.social-ic svg { width: 22px; height: 22px; }
.social-meta { line-height: 1.2; }
.social-meta .s-lbl { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.social-meta .s-val { font-size: 15.5px; color: var(--ink); font-weight: 700; }

.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 40px 24px 32px; align-items: center; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }

/* steps */
.step-num { width: 46px; height: 46px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }

/* success result cards */
.success-card { overflow: hidden; }
.success-stat { font-size: 22px; font-weight: 800; color: var(--teal); letter-spacing: -0.02em; }

/* masonry for feedback wall */
.masonry { column-gap: 18px; columns: 3; }
.masonry > * { break-inside: avoid; margin-bottom: 18px; display: inline-block; width: 100%; }
@media (max-width: 880px) { .masonry { columns: 2; } }
@media (max-width: 560px) { .masonry { columns: 1; } }

/* condition card icon tile */
.cond-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(28,52,47,.40);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 18px; overflow-y: auto;
  animation: fade .2s ease both;
}
.modal {
  background: var(--card); border-radius: 24px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); margin: auto; animation: pop .26s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: none; background: var(--bg-2); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.icon-btn:hover { background: var(--line); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* range slider (commitment) */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; background: var(--line); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--teal); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(47,158,143,.4); cursor: pointer; }
.range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--teal); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(47,158,143,.4); cursor: pointer; }

/* ============================================================
   PUBLIC navbar
   ============================================================ */
.pub-nav { position: sticky; top: 0; z-index: 50; background: rgba(247,246,241,.85); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.pub-nav-inner { display: flex; align-items: center; gap: 24px; height: 76px; }
.pub-nav-inner .logo { order: 3; margin-right: auto; }
.pub-links { display: flex; align-items: center; gap: 6px; order: 1; }
.nav-toggle { order: 2; }
.pub-login-icon { order: 0; }
.pub-links a { padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--ink-2); transition: all .15s; cursor: pointer; }
.pub-links a:hover { background: var(--teal-tint-2); color: var(--teal-700); }
.pub-login { font-size: 13.5px !important; color: var(--ink-3) !important; }
.pub-login:hover { color: var(--teal-700) !important; background: transparent !important; }
.pub-login-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--ink-3); border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; transition: all .15s; }
.pub-login-icon:hover { color: var(--teal); border-color: var(--teal); }
.pub-login-icon svg { width: 19px; height: 19px; }
.nav-toggle { display: none; }

/* ============================================================
   ADMIN shell
   ============================================================ */
.admin-shell { display: grid; grid-template-columns: 1fr 256px; min-height: 100vh; }
.admin-main { min-width: 0; padding: 30px 34px 60px; }
.side-nav {
  position: sticky; top: 0; height: 100vh; background: #fff; border-inline-start: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 24px 18px;
}
.side-nav .logo { padding: 6px 8px 22px; }
.side-link {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px; border-radius: 13px;
  color: var(--ink-2); font-weight: 600; font-size: 15.5px; cursor: pointer; transition: all .15s; margin-bottom: 4px;
}
.side-link svg { width: 21px; height: 21px; flex: none; }
.side-link:hover { background: var(--bg); color: var(--ink); }
.side-link.active { background: var(--teal-tint); color: var(--teal-700); }
.side-link.active svg { color: var(--teal); }
.side-foot { margin-top: auto; }
.side-logout { color: var(--red); }
.side-logout:hover { background: var(--red-tint); color: #b1473e; }

.admin-topbar { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.admin-topbar .search { flex: 1; min-width: 220px; max-width: 420px; margin-inline-start: auto; }
.greet { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.greet + .sub { color: var(--ink-3); font-size: 14.5px; font-weight: 600; }

.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--ink-3); }

/* mobile bottom tab bar (admin) */
.tabbar { display: none; }

/* ============================================================
   Timeline
   ============================================================ */
.timeline { position: relative; padding-inline-start: 26px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; inset-inline-start: -26px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--teal); }
.tl-dot.gift { border-color: var(--amber); }
.tl-dot.credit { border-color: var(--teal); background: var(--teal); }
.tl-date { font-size: 13px; font-weight: 700; color: var(--teal-700); margin-bottom: 3px; }
.tl-body { color: var(--ink-2); font-size: 14.5px; }
.tl-meta { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tl-tag { font-size: 12.5px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); padding: 3px 10px; border-radius: 999px; }

/* misc helpers */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; }
.grid { display: grid; }
.hide-mobile { }
.divider { height: 1px; background: var(--line); border: none; margin: 0; }
.skip { } /* anchor */

/* responsive two-column layouts (replace inline grids so media queries can collapse them) */
.split-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; padding: 64px 24px 56px; }
.about-grid { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: center; padding: 40px; }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.patient-grid { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 920px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side-nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; width: 100%;
    flex-direction: row; align-items: stretch; padding: 0 0 env(safe-area-inset-bottom, 0); border-inline-start: none;
    border-top: 1px solid var(--line); z-index: 60; box-shadow: 0 -4px 20px rgba(20,55,48,.06);
  }
  .side-nav .logo { display: none; }
  .side-nav > nav { flex-direction: row !important; flex: 1; width: 100%; }
  .side-link { flex-direction: column; gap: 4px; font-size: 10.5px; padding: 8px 3px; flex: 1; min-width: 0; margin: 0; border-radius: 0; text-align: center; justify-content: center; }
  .side-link svg { width: 22px; height: 22px; }
  .side-link span { font-size: 10.5px; line-height: 1.15; }
  .side-link.active { background: transparent; color: var(--teal-700); }
  .side-link.active svg { color: var(--teal); }
  .side-foot { display: none; }
  .admin-main { padding: 22px 18px 92px; }
}

@media (max-width: 860px) {
  .split-hero { grid-template-columns: 1fr; gap: 32px; padding: 44px 24px 40px; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; padding: 28px; text-align: center; }
  .about-grid .ph-circle { margin: 0 auto; }
  .dash-grid { grid-template-columns: 1fr; }
  .patient-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .pub-nav-inner { justify-content: space-between; position: relative; }
  .pub-nav-inner .logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); margin: 0; }
  .pub-login-icon { order: 1; }
  .nav-toggle { order: 2; margin-inline-start: 0; }
  .pub-links { display: none; position: absolute; top: 76px; right: 0; left: 0; background: #fff; flex-direction: column; align-items: stretch; gap: 0; padding: 8px; box-shadow: var(--shadow-md); border-bottom: 1px solid var(--line); }
  .pub-links.open { display: flex; }
  .pub-links a { padding: 14px 16px; border-radius: 10px; }
  .nav-toggle { display: grid; place-items: center; margin-inline-start: 0; width: 44px; height: 44px; border-radius: 11px; border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; color: var(--ink); }
  .nav-toggle svg { width: 22px; height: 22px; }
  .container { padding: 0 18px; }
  .greet { font-size: 22px; }

  /* full hero: image up top, text over a cream gradient (keeps the light palette) */
  .hero-full, .hero-full-flex { min-height: 480px; }
  .hero-full-flex { align-items: flex-end; }
  .hero-full-scrim { background: linear-gradient(180deg, rgba(247,246,241,.08) 0%, rgba(247,246,241,.5) 36%, rgba(247,246,241,.93) 66%, rgba(247,246,241,.99) 100%); }
  .hero-full-text { max-width: 100%; padding: 26px 22px 30px; margin: 0; }

  /* trust strip: 2 columns */
  .trust { grid-template-columns: repeat(2, 1fr); }
  .trust > div { font-size: 13.5px; padding: 15px 12px; }
  .trust > div:nth-child(odd) { border-inline-start: none; }
  .trust > div:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.16); }
}
