/* ─────────────────────────────────────────────────────────────
   Maro Secure Link — Immunization Records demo
   Visual styles (extracted from original, refactored with vars)
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Chewie DEMO';
  font-weight: 600;
  font-style: normal;
  src: url('chewie-demo.otf') format('opentype');
}

:root {
  /* Brand */
  --brand:        #6937f3;
  --brand-hover:  #5a2de0;
  --brand-soft:   rgba(105, 55, 243, 0.05);
  --brand-shadow: rgba(105, 55, 243, 0.28);
  --brand-shadow-hover: rgba(105, 55, 243, 0.36);
  --brand-shadow-active: rgba(105, 55, 243, 0.20);

  /* Neutrals */
  --ink:          #4b3425;
  --ink-soft:     #8b7a6b;
  --ink-faint:    rgba(75, 52, 37, 0.18);
  --line:         rgba(75, 52, 37, 0.08);
  --surface:      #f7f4f2;
  --bg:           #fff;

  /* Success / status */
  --success:      #409261;
  --success-bg:   #ecfff4;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Chewie DEMO', 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100%; -webkit-font-smoothing: antialiased }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  min-height: 100vh;
}

#shell {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── App header ── */
.appheader {
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}
.logo-wrap { width: 90px; height: 24px; position: relative; flex-shrink: 0 }
.secure-badge {
  background: var(--success-bg);
  display: flex; gap: 4px; align-items: center;
  padding: 4px 8px; border-radius: 4px; flex-shrink: 0;
}
.secure-badge span {
  font-weight: 500; font-size: 12px;
  color: var(--success); white-space: nowrap;
}

/* ── Scrollable area ── */
#page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch }
#sections { display: flex; flex-direction: column; padding: 2px 16px 8px }

/* ── Footer ── */
.dt-footer-inner { display: none }
.appfooter {
  display: flex; gap: 16px; align-items: center; justify-content: center;
  padding: 12px 16px; flex-shrink: 0;
}
.appfooter a {
  font-weight: 500; font-size: 12px; color: var(--ink);
  text-decoration: underline; white-space: nowrap; cursor: pointer;
}

/* ── Divider ── */
.divider { height: 1px; background: var(--line) }

/* ── Section header ── */
.sec-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.sec-hdr.can-click { cursor: pointer }

/* ── Typography ── */
.section-title {
  font-family: var(--font-display);
  font-weight: 800; font-size: 20px;
  color: var(--ink); line-height: 28px;
}
.sec-subtitle { font-weight: 500; font-size: 14px; color: var(--ink); margin-top: 2px }
.label { font-weight: 500; font-size: 14px; color: var(--ink-soft) }
.val {
  font-weight: 500; font-size: 14px; color: var(--ink);
  margin-top: 2px; display: none;
}
.row-block { display: flex; flex-direction: column }

/* ── Accordion body ── */
.sec-bdy {
  overflow: hidden; max-height: 0;
  transition: max-height .34s cubic-bezier(.4, 0, .2, 1);
}

/* ── Chevron ── */
.chev { flex-shrink: 0; transition: transform .28s ease }
.chev path { transition: stroke .2s }
.chev.purple path { stroke: var(--brand) }
.chev.dim path    { stroke: var(--ink-faint) }
.chev.brown path  { stroke: var(--ink-soft) }
.chev.up   { transform: rotate(0deg) }
.chev.down { transform: rotate(180deg) }

/* Records Request chevron is hidden on the landing screen; JS reveals it
   once the user advances past the landing state. */
#ctx-chev { display: none }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.card-white {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── Contact / avatar ── */
.contact-row { display: flex; align-items: center; justify-content: space-between }
.contact-info { display: flex; gap: 8px; align-items: center }
.avatar {
  width: 32px; height: 32px; border-radius: 32px;
  background: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar span { font-weight: 500; font-size: 13px; color: var(--ink) }
.contact-name { font-weight: 500; font-size: 14px; color: var(--ink) }
.contact-role { font-weight: 500; font-size: 13px; color: var(--ink-soft) }
.contact-phone { font-weight: 500; font-size: 14px; color: var(--brand) }

/* ── Button ── */
.btn {
  background: var(--brand); border: none; border-radius: 8px;
  padding: 16px; width: 100%; color: #fff;
  font-family: var(--font-sans);
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  box-shadow: 0 3px 8px -1px var(--brand-shadow);
}
.btn:hover  { background: var(--brand-hover); box-shadow: 0 4px 10px -1px var(--brand-shadow-hover) }
.btn:active { opacity: .85; box-shadow: 0 1px 4px var(--brand-shadow-active) }

/* ── OTP inputs ── */
.otp-wrap { display: flex; gap: 8px; justify-content: center }
.otp-box {
  width: 40px; height: 48px;
  background: var(--surface);
  border: 1.5px solid rgba(75, 52, 37, .12);
  border-radius: 8px;
  text-align: center;
  font-size: 18px; font-weight: 600; color: var(--ink);
  font-family: var(--font-sans);
  outline: none;
  -webkit-appearance: none;
  transition: border-color .12s;
}
.otp-box:focus { border-color: var(--brand) }
.otp-filled { border-color: rgba(75, 52, 37, .12) }
.otp-display {
  width: 40px; height: 48px;
  background: var(--surface);
  border: 1.5px solid rgba(75, 52, 37, .12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--ink);
  font-family: var(--font-sans);
}

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg) } }
.spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(139, 122, 107, .15);
  border-top-color: var(--ink-soft);
  border-radius: 50%;
  animation: spin .85s linear infinite;
  flex-shrink: 0;
}

/* ── Progress bar ── */
@keyframes prog { from { width: 0 } to { width: 100% } }
.progress-track {
  width: 100%; height: 4px; background: #fff;
  border-radius: 8px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--ink-soft);
  border-radius: 8px;
  animation: prog 7s linear forwards;
}

/* ── Vaccine rows ── */
.vax-row { display: flex; align-items: center; gap: 6px; width: 100% }
.vax-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.vax-name {
  font-weight: 500; font-size: 13px;
  color: var(--ink); flex-shrink: 0;
}
.vax-rule { flex: 1; border-bottom: 1px dashed rgba(75, 52, 37, .15) }
.vax-doses {
  font-weight: 500; font-size: 13px;
  color: var(--ink); flex-shrink: 0; white-space: nowrap;
}

/* ── Three-dot ── */
.threedots {
  display: flex; flex-direction: column; gap: 3px;
  padding: 2px; flex-shrink: 0;
}
.dot { width: 4px; height: 4px; border-radius: 2px; background: var(--ink) }

/* ── Thank you pill ── */
.pill {
  display: inline-flex; gap: 6px; align-items: center;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: 32px; padding: 8px 12px;
  align-self: flex-start;
}
.pill span { font-weight: 500; font-size: 12px; color: var(--success) }

/* ── Checkbox ── */
.auth-chk-input { position: absolute; opacity: 0; width: 0; height: 0 }
.chk-box {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid rgba(75, 52, 37, .25);
  background: var(--surface);
  flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.chk-label {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-weight: 500; font-size: 12px; color: var(--ink); line-height: 18px;
}

/* ── Animations ── */
@keyframes fadein {
  from { opacity: 0; transform: translateY(4px) }
  to   { opacity: 1; transform: translateY(0) }
}
.fadein { animation: fadein .25s ease forwards }
@keyframes popIn {
  0%   { transform: scale(.7);  opacity: 0 }
  70%  { transform: scale(1.08) }
  100% { transform: scale(1);   opacity: 1 }
}
.pop-in { animation: popIn .45s cubic-bezier(.34, 1.56, .64, 1) forwards }

/* ── Restart button (hidden in corner) ── */
.restart-btn {
  position: fixed;
  bottom: 12px; left: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(75, 52, 37, 0.06);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity .15s, background .15s;
  z-index: 50;
}
.restart-btn:hover {
  opacity: 1;
  background: var(--surface);
}

/* ─────────────────────────────────────────────────────────────
   DESKTOP LAYOUT ≥1060px
   ───────────────────────────────────────────────────────────── */
@media (min-width: 1060px) {
  .appheader { padding: 0 32px }
  .appheader > svg:first-child { width: 120px; height: 32px }

  /* Landing: centered 480px column */
  #shell.dt-landing #page,
  #shell.dt-done #page {
    display: flex; flex-direction: row;
    justify-content: center; align-items: flex-start;
  }
  #shell.dt-landing #sections,
  #shell.dt-done #sections {
    width: 480px; max-width: 480px;
    padding: 32px; flex-shrink: 0; overflow-y: visible;
  }
  #shell.dt-working #page {
    display: flex; flex-direction: row;
    align-items: stretch; flex: 1;
  }
  #shell.dt-working #sections {
    order: 1; width: 580px; flex-shrink: 0;
    padding: 32px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  #shell.dt-working #sec-ctx { display: none }
  #shell.dt-working #dt-right {
    order: 2; display: flex; flex-direction: column;
    flex: 1; padding: 32px; overflow-y: auto;
  }

  /* Done: centered 480px column */
  #shell.dt-done #page {
    display: flex; flex-direction: row;
    justify-content: center; align-items: flex-start;
  }
  #shell.dt-done #steps-wrap { display: none !important }

  /* Hide right col on non-working states */
  #shell.dt-landing #dt-right,
  #shell.dt-done #dt-right { display: none }

  .appfooter { padding: 12px 32px }

  /* Footer behavior per state */
  #shell.dt-working .appfooter { display: none }
  #shell.dt-landing .appfooter,
  #shell.dt-done .appfooter {
    display: flex; max-width: 480px; width: 100%;
    margin: 0 auto; padding: 12px 32px; box-sizing: border-box;
  }

  #dt-footer-sections,
  #dt-spacer-sections { display: none !important }
  #shell.dt-working #dt-footer-right { display: flex }
  #shell.dt-landing #dt-footer-right,
  #shell.dt-done #dt-footer-right { display: none }

  .dt-footer-inner {
    gap: 16px; align-items: center; justify-content: center;
    padding-top: 16px; flex-shrink: 0;
  }
  .dt-footer-inner a {
    font-weight: 500; font-size: 12px; color: var(--ink);
    text-decoration: underline; white-space: nowrap; cursor: pointer;
  }

  #shell { display: flex; flex-direction: column }
  #page { max-width: 1060px; width: 100%; margin: 0 auto; flex: 1 }
  .appheader { max-width: 1060px; width: 100%; margin: 0 auto; box-sizing: border-box }
  .appfooter { max-width: 1060px; width: 100%; margin: 0 auto; box-sizing: border-box }

  /* Desktop chevron background boxes per Figma design system */
  .chev { border-radius: 4px }
  .chev.purple { background: var(--brand-soft) }
  .chev.brown  { background: var(--surface) }
  /* Disabled chevron on desktop: beige box, WHITE arrow */
  .chev.dim      { background: rgba(75, 52, 37, 0.08) }
  .chev.dim path { stroke: #fff }

  /* Hide the duplicate chevron in the right column when working state
     (the title there is informational, not collapsible). */
  #shell.dt-working #dt-right .chev { display: none }

  #page { min-height: 0 }

  #shell.dt-landing #sec-ctx .sec-hdr,
  #shell.dt-done    #sec-ctx .sec-hdr { padding-top: 0 }

  #shell.dt-working #steps-wrap > .divider:first-child { display: none }

  #shell.dt-landing #sections,
  #shell.dt-done    #sections { padding-top: 20px }
}
