/* ==================================================================
   Mercy Medical City - patient review page

   Light only. Mobile-first: the base rules target a phone and the one
   media query scales things UP for the occasional desktop visit.

   Every colour below is sampled from assets/img/logo.png rather than
   guessed - deep teal #056074 and mid teal #076f85 from the Kurdish
   line, charcoal #474648 from the MMC wordmark, silver #c7c8ca from
   the swoosh. The background motif is that same swoosh.
   ================================================================== */

:root {
  /* `light` stops iOS and Android auto-darkening form controls, which
     deleting the dark-mode rules on its own would not prevent. */
  color-scheme: light;

  --teal-deep:  #056074;   /* band, buttons, headings */
  --teal:       #076f85;   /* accent, focus ring */
  --teal-dark:  #044b5b;   /* pressed */
  --teal-wash:  #e8f1f4;   /* selected rows, tinted fills */

  --text:       #474648;   /* the wordmark's own charcoal */
  --muted:      #5d686d;
  --silver:     #c7c8ca;
  --line:       #dde4e7;

  --star:       #e0a03c;   /* muted gold; #F5A623 glares */
  --star-off:   #d3dadd;

  --bg:         #f4f7f8;
  --surface:    #ffffff;
  --surface-2:  #f6f9fa;
  --danger:     #a8392f;

  --shadow:     0 1px 2px rgba(71,70,72,.04), 0 10px 30px rgba(5,96,116,.10);

  --radius:     18px;
  --radius-sm:  12px;

  --font-ar: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-en: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

/* Beats the display:block on .btn / .linkbtn / .field below. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: 14px 12px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text);
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;

  /* The swoosh ground. `fixed` keeps the arcs still while the card
     scrolls over them, which reads as depth rather than wallpaper. */
  background-color: var(--bg);
  background-image: url("../img/pattern-ground.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

/* Arabic-script languages get the Kufi face and more leading. */
html[dir="rtl"] body { font-family: var(--font-ar); line-height: 1.85; }

/* ---------- Language switcher ------------------------------------- */
.lang-bar {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.lang-btn {
  flex: 1;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(6px);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.lang-btn[aria-pressed="true"] {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
  font-weight: 600;
}

/* ---------- Card --------------------------------------------------- */
.card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;            /* clips the band to the rounded corners */
  padding: 0 18px 26px;        /* top padding belongs to the band */
}

/* ---------- Brand: teal band + white logo plaque -------------------- */
/* The logo artwork is charcoal and deep teal, so on a #056074 band it
   measures 1.31:1 and 1.00:1 - invisible. It therefore sits on a white
   plaque that straddles the band's lower edge. A CSS filter would have
   "fixed" the contrast by falsifying the brand teal, which is not an
   option for a hospital mark. */
.brand {
  margin: 0 -18px 20px;        /* bleed past the card's side padding */
  position: relative;
  padding-bottom: 54px;        /* room for the plaque's overhang */
}

.brand-band {
  height: 104px;
  background-color: var(--teal-deep);
  background-image: url("../img/pattern-band.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.brand-plaque {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 206px;
  max-width: calc(100% - 48px);
  padding: 12px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(5,96,116,.13);
}
.brand-plaque img {
  display: block;
  width: 100%;
  height: auto;
}
/* The wordmark is already inside the artwork, so the text version is
   only a fallback for when the image fails to load. */
.brand-name {
  font-size: 14px;
  color: var(--teal-deep);
  font-weight: 600;
}
.brand-plaque img + .brand-name { display: none; }

h1 {
  margin: 0 0 24px;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
}

/* ---------- Fields -------------------------------------------------- */
.field { margin-bottom: 22px; }

label, .label {
  display: block;
  margin-bottom: 9px;
  font-weight: 600;
  font-size: 15.5px;
}
.optional { font-weight: 400; font-size: 13px; color: var(--muted); }

input[type="text"], input[type="tel"], textarea {
  width: 100%;
  min-height: 52px;             /* comfortable thumb target */
  font: inherit;
  font-size: 16px;              /* 16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
::placeholder { color: var(--muted); opacity: .8; }

input:focus-visible, textarea:focus-visible,
.star:focus-visible, .btn:focus-visible, .lang-btn:focus-visible, .linkbtn:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(7,111,133,.26);
}

/* ---------- Stars --------------------------------------------------- */
/* The row inherits document direction, so in RTL star 1 sits on the
   right - which is what Kurdish and Arabic readers expect. */
.stars {
  display: flex;
  gap: 2px;
  justify-content: center;
  margin-bottom: 6px;
}
.star {
  border: 0;
  background: none;
  padding: 6px;
  min-width: 52px;
  min-height: 52px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--star-off);
  transition: transform .12s ease, color .12s ease;
  line-height: 0;
}
.star svg { width: 36px; height: 36px; fill: currentColor; }
.star.on { color: var(--star); }
.star:active { transform: scale(.92); }

.star-caption {
  text-align: center;
  min-height: 26px;
  font-size: 15px;
  font-weight: 600;
  color: var(--teal-deep);
}

/* ---------- Buttons -------------------------------------------------- */
.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  font: inherit;
  font-size: 16.5px;
  font-weight: 600;
  padding: 15px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--teal-deep);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(5,96,116,.22);
  transition: background .15s, opacity .15s;
}
.btn:active { background: var(--teal-dark); }
.btn[disabled] { opacity: .55; cursor: default; box-shadow: none; }

.linkbtn {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  font: inherit;
  font-size: 15px;
  padding: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* ---------- Error ---------------------------------------------------- */
.error {
  margin: -6px 0 14px;
  color: var(--danger);
  font-size: 14.5px;
  font-weight: 600;
}

/* ---------- Result screens -------------------------------------------- */
.result { text-align: center; }
.result .mark {
  width: 64px; height: 64px;
  margin: 2px auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal-wash);
  color: var(--teal-deep);
}
.result .mark svg { width: 32px; height: 32px; }
.result h2 { margin: 0 0 10px; font-size: 20px; font-weight: 700; color: var(--teal-deep); }
.result p { margin: 0 0 22px; color: var(--muted); font-size: 15.5px; }

.result-stars {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--star);
}
.result-stars svg { width: 26px; height: 26px; fill: currentColor; }

/* ---------- Contact block ---------------------------------------------- */
.contact {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.contact .label { margin-bottom: 4px; }
.contact .hint { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.contact .row { margin-bottom: 12px; }
.contact .row:last-child { margin-bottom: 0; }
.contact input { background: var(--surface); }
/* Phone numbers always read LTR, even on an RTL page. */
.contact input[type="tel"] { direction: ltr; text-align: start; }

/* ---------- Footer ------------------------------------------------------ */
.foot {
  max-width: 520px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.foot .tag { color: var(--teal-deep); font-weight: 600; }

/* ---------- Setup warning (staff-facing, misconfiguration only) --------- */
.setup-warn {
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.6;
  text-align: start;
}
.setup-warn code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* ---------- Scale up on tablets and desktops ---------------------------- */
@media (min-width: 560px) {
  body { padding: 28px 16px 44px; gap: 18px; }
  .lang-bar { justify-content: flex-end; }
  .lang-btn { flex: 0 0 auto; padding: 8px 18px; }

  .card { padding: 0 32px 34px; }
  .brand { margin: 0 -32px 24px; padding-bottom: 60px; }
  .brand-band { height: 120px; }
  .brand-plaque { width: 244px; padding: 14px 20px; }

  h1 { font-size: 24px; }

  .star:hover { transform: scale(1.1); }
  .btn:hover { background: var(--teal-dark); }
  .linkbtn:hover { color: var(--teal-deep); }
  .lang-btn:hover { border-color: var(--teal); color: var(--teal-deep); }

}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .star:hover, .star:active { transform: none; }
}

/* ---------- Auto-redirect countdown ------------------------------------ */
.redirect-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
