/* ============================================================
   Notiflye — Skylight design system
   Single source of truth for tokens, global styles,
   nav, footer, and shared components.
   ============================================================ */

/* ── 1. Design tokens ─────────────────────────────────────── */
:root {
  /* Palette */
  --blue:          #2563eb;
  --blue-dark:     #1d4ed8;
  --blue-light:    #eff6ff;
  --blue-mid:      #dbeafe;
  --green:         #059669;
  --green-light:   #ecfdf5;
  --green-border:  rgba(5,150,105,0.2);
  --amber:         #d97706;
  --amber-light:   #fffbeb;
  --amber-border:  rgba(217,119,6,0.2);
  --red:           #dc2626;
  --red-light:     #fef2f2;
  --red-border:    rgba(220,38,38,0.2);

  /* Neutrals */
  --ink:           #0f172a;
  --ink-2:         #1e293b;
  --muted:         #64748b;
  --stone:         #cbd5e1;
  --sand:          #e2e8f0;
  --warm:          #f8fafc;
  --white:         #ffffff;
  --bg:            #f4f8ff;

  /* Legacy aliases (used by inline-styled templates) */
  --cream:         var(--bg);
  --warm-white:    var(--warm);
  --charcoal:      var(--ink);
  --royal:         var(--blue);
  --royal-hover:   var(--blue-dark);
  --royal-light:   var(--blue-light);
  --royal-ring:    rgba(37,99,235,0.12);
  --royal-glow:    rgba(37,99,235,0.08);
  --success:       var(--green);
  --success-light: var(--green-light);
  --success-border:var(--green-border);
  --warning:       var(--amber);
  --warning-light: var(--amber-light);
  --warning-border:var(--amber-border);
  --danger:        var(--red);
  --danger-light:  var(--red-light);
  --danger-border: var(--red-border);
  --card-shadow:   0 1px 4px rgba(15,23,42,0.04), 0 4px 20px rgba(15,23,42,0.06);

  /* Typography */
  --font:          'Figtree', system-ui, -apple-system, sans-serif;
  --font-mono:     'Figtree', ui-monospace, 'SF Mono', monospace;

  /* Radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 6px rgba(15,23,42,0.05);
  --shadow-md: 0 2px 12px rgba(15,23,42,0.07);
  --shadow-lg: 0 20px 60px rgba(15,23,42,0.15);

  /* Layout */
  --max-w:        900px;
  --max-w-wide:   1080px;
  --max-w-narrow: 700px;
  --max-w-app:    540px;   /* phone-first app content width (~36ch lines) */

  /* App-shell readable-character contract (see docs/WEB_DESIGN_LANGUAGE.md) */
  --fs-base:      16px;    /* minimum body size — also blocks iOS input zoom */
  --tap-min:      44px;    /* minimum interactive height */

  /* App-screen aliases — let the inline-token templates (dashboard, etc.)
     source their values from this single file instead of redeclaring :root. */
  --paper:        var(--bg);
  --card:         var(--white);
  --rule:         rgba(15,23,42,0.10);
  --ink-3:        var(--muted);
  --ink-4:        #94a3b8;
  --accent:       var(--blue);
  --accent-soft:  var(--blue-light);
  --accent-ink:   var(--blue-dark);
  --green-soft:   #dcfce7;
  --amber-soft:   #fef3c7;
  --red-soft:     #fee2e2;
  --slate-soft:   #f1f5f9;
  --sans:         var(--font);
}

/* ── 2. Reset + base ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  min-height: 100vh;
  /* Guard the scroll root against sideways overflow on mobile (clip keeps
     vertical scroll, unlike overflow:hidden which can create a scroll box). */
  overflow-x: clip;
  max-width: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Remove old atmosphere layer used by paper/ink templates */
.atmosphere { display: none !important; }

/* ── 3. Shared nav (_nav.html) ────────────────────────────── */
header.nav,
nav.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* _nav.html uses .wrap.nav-inner inside a header.nav */
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
}
/* Keep the brand + Home together on the left; push the CTA to the far right. */
.nav-inner > .nav-cta { margin-left: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font);
}

/* Hide the decorative dot and italic tagline from old brand */
.brand .dot { display: none; }
.brand em   { display: none; }
.brand-logo { height: 26px; width: auto; display: block; }

/* _nav.html links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  /* .nav-links is a <nav>, so reset the generic `nav` rule's padding + auto
     margins that would otherwise push Home away from the brand. */
  padding: 0;
  margin: 0;
  max-width: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
  font-family: var(--font);
}

.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); font-weight: 700; }

.nav-cta {
  background: var(--blue);
  color: var(--white) !important;
  padding: 0.5rem 1.1rem;
  border-radius: var(--r-md);
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.nav-cta:hover {
  background: var(--blue-dark) !important;
  color: var(--white) !important;
  transform: translateY(-1px);
}

/* Inline-template nav (logo + nav-links + btn-track) */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font);
}

/* ── 4. Footer (_footer.html) ─────────────────────────────── */
footer.site,
footer {
  border-top: 1px solid var(--sand);
  margin-top: 4rem;
  padding: 2.5rem 2rem;
  font-family: var(--font);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  max-width: var(--max-w-wide);
  margin: 0 auto 2rem;
}

.footer-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.footer-brand p {
  font-weight: 400;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 0.5rem;
}

.footer-col .h {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.footer-col a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  transition: color 0.15s;
}

.footer-col a:hover { color: var(--blue); }

/* Flat link row (_footer.html) — no columns, no brand block. */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  max-width: var(--max-w-wide);
  margin: 0 auto 2rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--blue); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sand);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Simple inline footers */
footer:not(.site) {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

footer:not(.site) a {
  color: var(--muted);
  text-decoration: none;
}

footer:not(.site) a:hover { color: var(--blue); }

/* ── 5. Shared layout utilities ───────────────────────────── */
.wrap {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 2rem;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── 6. Page header (about, privacy, terms, contact) ─────── */
.page { padding: 3rem 0 5rem; }

.page-head {
  margin-bottom: 3rem;
}

.page-kicker {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.page-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  font-family: var(--font);
}

.page-title em { font-style: italic; }

.page-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── 7. Prose (legal pages, about) ───────────────────────── */
.prose {
  font-size: 0.97rem;
  color: var(--ink-2);
  line-height: 1.8;
  max-width: 68ch;
}

.prose h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin: 2.5rem 0 0.6rem;
  font-family: var(--font);
}

.prose h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 1.75rem 0 0.4rem;
}

.prose p  { margin-bottom: 1.1rem; }
.prose ul, .prose ol { margin: 0.5rem 0 1.1rem 1.5rem; }
.prose li { margin-bottom: 0.35rem; }

.prose a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.prose a:hover { text-decoration: underline; }

.prose strong { font-weight: 700; color: var(--ink); }

.prose .sign-off {
  font-style: italic;
  color: var(--muted);
  margin-top: 2rem;
}

/* Callouts */
.callout, .callout-warn {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.callout-warn {
  background: var(--amber-light);
  border-left-color: var(--amber);
}

/* ── 8. Cards ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

/* ── 9. Buttons ───────────────────────────────────────────── */
.btn,
button.btn-primary,
a.btn-primary,
button.btn-secondary,
a.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.1rem;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--stone);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--sand);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--blue-mid);
  color: var(--blue);
}

.btn-danger {
  background: var(--white);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.btn-danger:hover { background: var(--red-light); }

/* ── 10. Forms ────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
  font-family: var(--font);
}

.form-input,
.form-select,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--sand);
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--royal-ring);
}

.form-error {
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 4px;
  min-height: 1.2em;
  font-family: var(--font);
}

.form-help {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ── 11. Modals ───────────────────────────────────────────── */
.modal-backdrop,
.modal-overlay,
.detail-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

.modal-backdrop.open,
.modal-overlay.open,
.detail-modal-overlay.open { display: flex; }

@keyframes fadeIn  { from { opacity: 0; }             to { opacity: 1; }             }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.modal,
.modal-box,
.detail-modal-box {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
}

.modal       { max-width: 560px; }
.modal-box   { max-width: 400px; padding: 1.75rem; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.6rem;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--font);
}

.modal-body   { padding: 0.5rem 1.5rem 1.5rem; }
.modal-footer {
  padding: 0.75rem 1.5rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Close icon button */
.btn-icon {
  background: var(--warm);
  border: 1px solid var(--sand);
  border-radius: var(--r-sm);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover { background: var(--sand); color: var(--ink); }

/* ── 12. Status pills ─────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font);
  white-space: nowrap;
}

.status-draft     { background: var(--sand);          color: var(--ink-2); }
.status-pending   { background: var(--amber-light);   color: var(--amber); }
.status-active    { background: var(--green-light);   color: var(--green); }
.status-completed { background: var(--blue-light);    color: var(--blue);  }
.status-cancelled { background: var(--red-light);     color: var(--red);   }

/* ── 13. Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(15,23,42,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
  font-family: var(--font);
  white-space: nowrap;
}

.toast.visible { opacity: 1; }
.toast.error   { background: var(--red); }

/* ── 14. Empty states ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-family: var(--font);
}

.empty-icon  { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.35; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* ── 15. Loading spinner ──────────────────────────────────── */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--sand);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(248,250,252,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.loading-overlay.show { display: flex; }

/* ── 16. Contact / info page card ─────────────────────────── */
.contact-card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: var(--r-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.send-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.5rem;
}

.send-btn:hover { background: var(--blue-dark); }

.contact-msg { display: none; font-size: 0.88rem; margin-top: 0.75rem; text-align: center; }
.contact-msg.success { display: block; color: var(--green); }
.contact-msg.error   { display: block; color: var(--red); }

/* ── 17. Section heading helpers ──────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem 0 1.25rem;
}

.section-divider-line { flex: 1; height: 1px; background: var(--sand); }

.section-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover { text-decoration: underline; }

/* ── 18. Channel badges ───────────────────────────────────── */
.channel-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 5px;
}

.channel-email    { background: var(--blue-mid);   color: var(--blue);  }
.channel-sms      { background: var(--green-light); color: var(--green); }
.channel-whatsapp { background: #dcfce7;            color: #16a34a;      }

/* ── 19. Info box ─────────────────────────────────────────── */
.info-box {
  background: var(--blue-light);
  border: 1px solid rgba(37,99,235,0.18);
  border-radius: var(--r-md);
  padding: 0.9rem 1.1rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-2);
}

/* ── 20b. App shell (three-zone layout) ───────────────────────
   The phone-first contract: top bar + canvas + action dock on a
   100dvh flex column. Only the canvas scrolls. See
   docs/WEB_DESIGN_LANGUAGE.md. Generalizes the wizard skeleton so
   non-wizard screens get the same app-like structure. */
.app-shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;            /* allow the canvas to scroll, not the page */
  width: 100%;
  max-width: var(--max-w-app);
  margin: 0 auto;
  overflow-x: clip;         /* never let a wide child scroll the shell sideways */
}

.app-topbar {
  flex: 0 0 auto;
  padding: 14px 18px 8px;
}

.app-canvas {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 12px;
}

.app-dock {
  flex: 0 0 auto;
  /* Reserve room for the Android/iOS system navigation bar. --nav-safe is set in
     JS (measures env(safe-area-inset-bottom); falls back to the standard Android
     nav-bar height when the browser reports 0, which Android Chrome/Samsung often
     does even edge-to-edge). The env()/floor is the fallback if JS hasn't run. */
  padding: 12px 18px calc(12px + var(--nav-safe, max(env(safe-area-inset-bottom, 0px), 16px)));
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

/* Dock CTA — full-width, thumb-reachable, meets --tap-min. */
.app-dock .cta,
.btn-full {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 15px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--white);
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--fs-base);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.app-dock .cta:disabled,
.btn-full:disabled { opacity: .45; cursor: not-allowed; }

/* ── 20. Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  nav, header.nav { padding: 0.85rem 1.25rem; }
  .wrap, .container { padding: 0 1.25rem; }

  /* Content-page nav (_nav.html): now just Home + the CTA, so both fit a phone.
     Tighten the CTA a touch so brand + Home + Track My Flight clear a small
     screen. */
  .nav-links a { font-size: 0.85rem; white-space: nowrap; }
  .nav-inner { gap: 0.85rem; }
  .nav-inner > .nav-cta { padding: 0.42rem 0.7rem; font-size: 0.8rem; }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }

  .page-title { font-size: 1.8rem; }

  .modal { max-width: 100%; }
}
