/* Fullscreen phone app — reuses the app state visuals from styles.css but makes
   the "screen" fill the entire device viewport (no website chrome, no frame). */
@import url("styles.css");

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fdf4e7;
}

/* the app fills the whole screen */
.fs-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fffdf9, #fdf4e7);
  color: var(--ink);
  transition: background 0.4s ease;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* reuse the state backgrounds full-bleed */
.fs-screen.state-detect { background: linear-gradient(180deg,#fff6ec,#ffe9d2); }
.fs-screen.state-checkin { background: linear-gradient(180deg,#fff4e6,#ffe6cc); }
.fs-screen.state-dismissed { background: linear-gradient(180deg,#fdfbf5,#f3f8ee); }
.fs-screen.state-escalate { background: linear-gradient(180deg,#fff0f0,#ffe0e0); }

/* status bar sits at the very top */
.fs-screen .app-status {
  padding: calc(env(safe-area-inset-top) + 22px) 26px 14px;
  font-size: 15px;
}

/* bodies grow to fill, content centered and larger for a real phone */
.fs-screen .idle-body,
.fs-screen .detect-body,
.fs-screen .checkin-body,
.fs-screen .escalate-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 0 32px; gap: 14px;
}
.fs-screen .brain-pulse { font-size: 56px; }
.fs-screen .idle-title { font-size: 30px; }
.fs-screen .idle-sub, .fs-screen .detect-sub, .fs-screen .checkin-sub { font-size: 15px; }
.fs-screen .detect-icon { font-size: 76px; }
.fs-screen .detect-title { font-size: 26px; }
.fs-screen .big-check { font-size: 86px; }
.fs-screen .checkin-title { font-size: 32px; }
.fs-screen .ring { width: 150px; height: 150px; border-width: 8px; font-size: 56px; }
.fs-screen .escalate-icon { font-size: 70px; }
.fs-screen .escalate-title { font-size: 22px; }
.fs-screen .escalate-list { font-size: 16px; max-width: 340px; }
.fs-screen .sim-badge { font-size: 13px; margin-top: 14px; }

.fs-screen .demo-btn.big { max-width: 360px; font-size: 17px; padding: 16px; }

.fs-screen .app-foot {
  padding: 16px 26px calc(env(safe-area-inset-bottom) + 16px);
  font-size: 12px;
}

/* honest sim banner pinned to the bottom edge */
.fs-simbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(58,47,38,0.85); color: #fff;
  font-size: 11px; text-align: center; padding: 6px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
}

/* ===== welcome / intro screen ===== */
.fs-screen.state-welcome { background: linear-gradient(180deg,#fffdf9,#fdf0dd); }
.welcome-body {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 0 30px; gap: 8px;
}
.welcome-logo {
  width: 72px; height: 72px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 38px; border-radius: 20px;
  box-shadow: 0 10px 30px rgba(234,115,23,0.3); margin-bottom: 8px;
}
.welcome-title { font-size: 34px; font-weight: 800; margin: 0; letter-spacing: 0.5px; }
.welcome-tag { font-size: 15px; color: var(--muted); margin: 0 0 18px; }
.welcome-points { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-bottom: 26px; max-width: 320px; }
.welcome-points div { font-size: 14px; color: var(--ink); display: flex; gap: 10px; align-items: flex-start; }
.welcome-points span { font-size: 18px; flex: 0 0 auto; }

/* ===== lock screen + notification ===== */
.fs-screen.state-lock { background: linear-gradient(160deg,#3a2f26,#6b4a2a); color: #fff; }
.lock-top { text-align: center; padding-top: calc(env(safe-area-inset-top) + 60px); }
.lock-date { font-size: 15px; opacity: 0.85; }
.lock-clock { font-size: 66px; font-weight: 300; letter-spacing: 1px; }
.lock-notif-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 40px 18px 0; gap: 12px; }
.lock-status { font-size: 13px; opacity: 0.8; display: flex; align-items: center; gap: 8px; }
.lock-status .status-dot { width: 9px; height: 9px; }
.lock-foot { text-align: center; font-size: 12px; opacity: 0.7; padding: 20px 30px calc(env(safe-area-inset-bottom) + 24px); }

.notif {
  width: 100%; max-width: 360px;
  background: rgba(255,255,255,0.92); color: var(--ink);
  border-radius: 18px; padding: 14px 16px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: notif-drop 0.5s ease;
}
@keyframes notif-drop { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.notif:active { transform: scale(0.98); }
.notif-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.notif-app { font-weight: 700; color: var(--accent-2); }
.notif-title { font-size: 15px; font-weight: 700; }
.notif-body { font-size: 13px; color: var(--muted); margin-top: 2px; }
.notif-hint { font-size: 12px; color: #fff; opacity: 0.8; animation: pulse 1.4s infinite; }

/* ===== app shell with bottom tab bar ===== */
.fs-screen.state-app { background: #fdfaf5; }
.app-view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.tabbar {
  flex: 0 0 auto;
  display: flex; border-top: 1px solid var(--line); background: #fffdf9;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; font-size: 11px; color: var(--muted);
}
.tabbar button.active { color: var(--accent-2); font-weight: 700; }
.tab-ico { font-size: 20px; }

/* monitor tab */
.lock-mini { display: flex; flex-direction: column; height: 100%; padding: 0 28px 24px; }
.monitor-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.big-dot { width: 18px; height: 18px; margin-bottom: 8px; }
.idle-note { font-size: 12px; color: var(--muted); max-width: 260px; margin-top: 6px; }

/* view headers */
.view-head { padding: calc(env(safe-area-inset-top) + 24px) 22px 10px; }
.view-head h2 { margin: 0; font-size: 22px; }
.view-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* history */
.hist-stats { display: flex; gap: 10px; padding: 8px 22px 14px; }
.hist-stat { flex: 1; background: #fffdf9; border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.hs-num { font-size: 24px; font-weight: 800; color: var(--accent-2); }
.hs-lab { font-size: 11px; color: var(--muted); }
.hist-list { padding: 0 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex; gap: 12px; align-items: center;
  background: #fffdf9; border: 1px solid var(--line);
  border-left-width: 4px; border-radius: 10px; padding: 11px 13px;
}
.hist-item.seizure { border-left-color: var(--accent-2); }
.hist-item.false { border-left-color: #d8c9b6; }
.hist-ico { font-size: 20px; width: 24px; text-align: center; }
.hist-item.seizure .hist-ico { color: var(--accent-2); }
.hist-main { flex: 1; }
.hist-top { display: flex; justify-content: space-between; align-items: baseline; }
.hist-type { font-weight: 700; font-size: 14px; }
.hist-when { font-size: 11px; color: var(--muted); }
.hist-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* doctor chat */
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 20px) 18px 14px;
  border-bottom: 1px solid var(--line); background: #fffdf9;
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.chat-name { font-weight: 700; font-size: 15px; }
.chat-role { font-size: 11px; color: var(--muted); }
.chat-online { margin-left: auto; font-size: 11px; color: var(--good); }
.chat-thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 76%; padding: 10px 13px; border-radius: 16px; font-size: 13px; line-height: 1.4; }
.bubble.doc { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fffdf9; }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 10px 14px; font-size: 14px; background: #fff; color: var(--ink); }
.chat-input button { border: none; background: var(--accent); color: #fff; border-radius: 20px; padding: 0 18px; font-weight: 600; cursor: pointer; }

/* ===== location permission screen ===== */
.fs-screen.state-perm { background: linear-gradient(180deg,#fffdf9,#fdf0dd); }
.perm-body { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 0 24px 28px; }
.perm-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.perm-pin { font-size: 54px; }
.perm-title { font-size: 24px; font-weight: 800; margin: 0; }
.perm-why { font-size: 14px; color: var(--muted); margin: 0; max-width: 300px; }
.perm-notes { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: left; max-width: 280px; }
.perm-notes li { margin-bottom: 6px; padding-left: 16px; position: relative; }
.perm-notes li:before { content: "✓"; position: absolute; left: 0; color: var(--good); }
.perm-notes b { color: var(--ink); }

/* iOS-style permission sheet */
.perm-sheet {
  background: rgba(255,255,255,0.97); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 16px 10px; text-align: center;
  box-shadow: 0 10px 30px rgba(120,80,20,0.14);
}
.perm-sheet-title { font-size: 15px; font-weight: 700; }
.perm-sheet-title b { color: var(--accent-2); }
.perm-sheet-sub { font-size: 12px; color: var(--muted); margin: 4px 0 10px; font-style: italic; }
.perm-map {
  background: #fdf0dd; border: 1px dashed var(--accent); border-radius: 10px;
  padding: 14px; font-size: 20px; margin-bottom: 12px; color: var(--accent-2);
}
.perm-map span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.perm-opt {
  width: 100%; border: none; background: none; cursor: pointer;
  padding: 12px; font-size: 15px; color: var(--accent-2);
  border-top: 1px solid var(--line);
}
.perm-opt.primary { font-weight: 700; }
.perm-opt.deny { color: var(--muted); }

/* location chips / status */
.loc-chip { margin-top: 12px; font-size: 12px; padding: 5px 12px; border-radius: 999px; display: inline-block; }
.loc-chip.on { background: rgba(224,161,0,0.14); color: #b58200; }
.loc-chip.off { background: rgba(229,72,77,0.12); color: var(--bad); }
.escalate-loc { font-size: 13px; margin-top: 8px; font-weight: 600; color: #b58200; }

/* ===== caregiver setup form ===== */
.care-form { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 320px; margin-top: 18px; text-align: left; }
.care-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.care-form input {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  font-size: 15px; background: #fff; color: var(--ink);
}
.care-form input:focus { outline: none; border-color: var(--accent); }
.care-actions { display: flex; flex-direction: column; gap: 8px; padding: 0 24px; }
.care-actions .demo-btn { width: 100%; }

/* ===== profile tab ===== */
.profile-card { text-align: center; padding: 10px 16px 18px; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 10px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
}
.profile-name { font-size: 20px; font-weight: 800; }
.profile-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

.prof-section { padding: 14px 18px; border-top: 1px solid var(--line); }
.prof-section-title { font-size: 12px; font-weight: 700; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.prof-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; padding: 4px 0; }
.prof-k { color: var(--muted); }
.prof-v { color: var(--ink); font-weight: 600; text-align: right; }
.prof-hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.toggle-row { cursor: pointer; }
.toggle { width: 44px; height: 26px; border-radius: 999px; background: #d8c9b6; position: relative; flex: 0 0 auto; transition: background 0.2s; }
.toggle.on { background: var(--good); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle.on .knob { left: 21px; }

.prof-actions { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.prof-actions .demo-btn { width: 100%; }
