/* =============================================================================
 * Wazima Health Assistant — landing page + floating chat widget.
 * Dependency-free, mobile-first, CSP-safe (system fonts, no external assets).
 * ========================================================================== */

:root {
  --wz-teal: #0e7c86;
  --wz-teal-dark: #0a5b62;
  --wz-teal-tint: #e6f3f4;
  --wz-ink: #16323a;
  --wz-muted: #5b7178;
  --wz-line: #dfe7e9;
  --wz-bg: #f4f7f8;
  --wz-card: #ffffff;
  --wz-user: #0e7c86;
  --wz-bot: #ffffff;
  --wz-warn: #b45309;
  --wz-warn-bg: #fef3c7;
  --wz-danger: #b91c1c;
  --wz-danger-bg: #fee2e2;
  --wz-ok: #15803d;
  --wz-pay: #0f9d58;
  --wz-radius: 14px;
  --wz-shadow: 0 8px 30px rgba(16, 50, 58, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--wz-ink);
  background:
    radial-gradient(1100px 500px at 50% -8%, var(--wz-teal-tint), transparent 60%),
    var(--wz-bg);
}

/* ============================ Landing page ============================== */
.site-banner {
  background: var(--wz-warn-bg);
  color: var(--wz-warn);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  padding: 8px 16px;
  border-bottom: 1px solid #f0e0b8;
}

.landing {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 20px 140px;
}

.hero { text-align: center; padding: 36px 12px 24px; }
.hero__logo {
  display: inline-grid; place-items: center;
  width: 66px; height: 66px; border-radius: 50%;
  background: #fff; color: var(--wz-teal-dark);
  font-size: 34px; margin-bottom: 18px;
  box-shadow: var(--wz-shadow);
}
.hero__title { font-size: clamp(26px, 5vw, 40px); margin: 0 0 12px; }
.hero__tag {
  font-size: 16px; color: var(--wz-muted);
  max-width: 580px; margin: 0 auto 24px; line-height: 1.55;
}
.hero__note { font-size: 12.5px; color: var(--wz-muted); margin-top: 14px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 26px;
}
.feature {
  position: relative;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(16, 50, 58, 0.05);
}
.feature__icon { font-size: 26px; }
.feature h3 { font-size: 15px; margin: 10px 0 6px; }
.feature p { font-size: 13px; color: var(--wz-muted); line-height: 1.5; margin: 0; }
.feature__tag {
  position: absolute; top: 14px; right: 14px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px;
}
.feature__tag--live { background: #dcfce7; color: var(--wz-ok); }
.feature__tag--soon { background: #eef2f3; color: var(--wz-muted); }

.landing__foot {
  text-align: center; font-size: 12.5px; color: var(--wz-muted);
  margin: 32px auto 0; max-width: 560px; line-height: 1.5;
}

/* ==================== Floating launcher (FAB) ========================== */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 1001;
  width: 60px; height: 60px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 26px; color: #fff;
  background: linear-gradient(135deg, var(--wz-teal), var(--wz-teal-dark));
  box-shadow: 0 10px 26px rgba(14, 124, 134, 0.45);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.05); }
.chat-fab--hidden { opacity: 0; pointer-events: none; transform: scale(0.6); }

/* ==================== Floating chat panel ============================== */
.chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 1000;
  width: min(400px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 96px));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 55px rgba(16, 50, 58, 0.30);
  opacity: 0; transform: translateY(18px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.chat-panel--open { opacity: 1; transform: none; pointer-events: auto; }

@media (max-width: 480px) {
  .chat-panel {
    right: 0; bottom: 0; top: 0; left: 0;
    width: 100vw; height: 100dvh; border-radius: 0;
  }
  .chat-fab { right: 16px; bottom: 16px; }
}

/* ---- Widget shell (fills the panel) --------------------------------------- */
.widget {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--wz-card);
  overflow: hidden;
}

/* ---- Header + banner ------------------------------------------------------ */
.widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--wz-teal), var(--wz-teal-dark));
  color: #fff;
}
.widget__brand { display: flex; align-items: center; gap: 10px; }
.widget__actions { display: flex; align-items: center; gap: 6px; }
.widget__logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18); font-size: 18px;
}
.widget__title { display: flex; flex-direction: column; line-height: 1.15; }
.widget__title strong { font-size: 15px; }
.widget__subtitle { font-size: 10px; letter-spacing: 0.06em; opacity: 0.85; }

.widget__banner {
  padding: 8px 14px;
  background: var(--wz-warn-bg);
  color: var(--wz-warn);
  font-size: 12px;
  line-height: 1.35;
  border-bottom: 1px solid #f0e0b8;
}

/* ---- Message list --------------------------------------------------------- */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--wz-bg);
}
.row { display: flex; }
.row--bot { justify-content: flex-start; }
.row--user { justify-content: flex-end; }

/* ---- Bubbles -------------------------------------------------------------- */
.bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: var(--wz-radius);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.bubble--bot { background: var(--wz-bot); border: 1px solid var(--wz-line); border-top-left-radius: 4px; }
.bubble--user { background: var(--wz-user); color: #fff; border-top-right-radius: 4px; }
.bubble--error { display: flex; gap: 8px; background: var(--wz-danger-bg); color: var(--wz-danger); border: 1px solid #fecaca; }
.bubble__icon { flex: 0 0 auto; }

/* ---- Cards ---------------------------------------------------------------- */
.card {
  max-width: 92%;
  background: var(--wz-card);
  border: 1px solid var(--wz-line);
  border-radius: var(--wz-radius);
  border-top-left-radius: 4px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(16, 50, 58, 0.05);
}
.card__title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.card__title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.card__title-row .card__title { margin-bottom: 0; }
.card__subtitle { font-size: 12px; color: var(--wz-muted); margin-bottom: 6px; }
.card__body { font-size: 13px; line-height: 1.45; }
.card__body--muted { color: var(--wz-muted); font-size: 12px; margin-top: 6px; }
.card--info { background: var(--wz-teal-tint); border-color: #c9e4e6; }

/* ---- Doctor list ---------------------------------------------------------- */
.card--list { width: 92%; }
.doctor { padding: 10px 0; border-top: 1px solid var(--wz-line); }
.doctor:first-of-type { border-top: none; }
.doctor__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.doctor__name { font-weight: 600; font-size: 14px; }
.doctor__rating { color: #eab308; font-size: 13px; letter-spacing: 1px; }
.doctor__meta { font-size: 12px; color: var(--wz-muted); margin-top: 2px; }
.doctor__bio { font-size: 12.5px; margin-top: 5px; color: var(--wz-ink); }
.doctor .btn { margin-top: 8px; }

/* ---- Slot grid ------------------------------------------------------------ */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 6px; }
.chip--slot { justify-content: center; text-align: center; }

/* ---- Fee card ------------------------------------------------------------- */
.card--fee { width: 92%; }
.fee { margin: 8px 0; }
.fee__line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.fee__label { color: var(--wz-muted); }
.fee__value { font-variant-numeric: tabular-nums; }
.fee__line--total { border-top: 1px dashed var(--wz-line); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 15px; }
.fee__line--total .fee__label { color: var(--wz-ink); }

/* ---- Appointment card ----------------------------------------------------- */
.card--appt { width: 92%; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge--pending { background: var(--wz-warn-bg); color: var(--wz-warn); }
.badge--ok { background: #dcfce7; color: var(--wz-ok); }
.badge--bad { background: var(--wz-danger-bg); color: var(--wz-danger); }
.countdown { margin-top: 8px; font-size: 13px; color: var(--wz-muted); background: var(--wz-teal-tint); border-radius: 8px; padding: 6px 10px; }
.countdown__time { font-weight: 700; color: var(--wz-teal-dark); font-variant-numeric: tabular-nums; }
.countdown--expired { background: var(--wz-danger-bg); color: var(--wz-danger); }

/* ---- Meeting card --------------------------------------------------------- */
.card--meeting { width: 92%; border-color: #bbf7d0; background: #f0fdf4; }

/* ---- Emergency card ------------------------------------------------------- */
.card--emergency { width: 92%; background: var(--wz-danger-bg); border: 2px solid var(--wz-danger); }
.card--emergency .card__title { color: var(--wz-danger); font-size: 15px; }
.card--emergency .card__body { color: #7f1d1d; }

/* ---- Buttons + chips ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 9px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--lg { font-size: 15px; padding: 13px 26px; border-radius: 999px; }
.btn--icon { padding: 6px 9px; }
.btn--primary { background: var(--wz-teal); color: #fff; }
.btn--primary:hover { background: var(--wz-teal-dark); }
.btn--ghost { background: rgba(255, 255, 255, 0.15); color: #fff; padding: 6px 10px; font-size: 12px; }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.28); }
.btn--pay { background: var(--wz-pay); color: #fff; width: 100%; margin-top: 6px; font-size: 14px; padding: 11px; }
.btn--pay:hover { background: #0b8047; }
.btn--join { background: var(--wz-ok); color: #fff; text-decoration: none; width: 100%; margin-top: 4px; padding: 11px; }
.btn--join:hover { background: #166534; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; max-width: 92%; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: var(--wz-teal-dark);
  border: 1px solid var(--wz-teal); border-radius: 999px;
  padding: 8px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.chip:hover { background: var(--wz-teal); color: #fff; }

/* ---- Persistent main-menu bar --------------------------------------------- */
.menu-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--wz-line);
  background: #fbfdfd;
  max-height: 108px; overflow-y: auto;
}
.menu-bar .chip { font-size: 12px; padding: 6px 11px; }

/* ---- Composer ------------------------------------------------------------- */
.composer {
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--wz-line);
  background: #fff;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.composer__input {
  flex: 1 1 auto;
  border: 1px solid var(--wz-line);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px; font-family: inherit; outline: none;
}
.composer__input:focus { border-color: var(--wz-teal); }
.composer__input:disabled { background: #f1f5f6; }

/* ---- Scrollbar (subtle) --------------------------------------------------- */
.messages::-webkit-scrollbar, .menu-bar::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb, .menu-bar::-webkit-scrollbar-thumb { background: #cbd8db; border-radius: 8px; }
