/* Shared Styles Across Multi-Page Health Web App (v0.2) */
:root {
  --primary: #0D9488;
  --primary-dark: #0F766E;
  --primary-light: #CCFBF1;
  --primary-bg: #F0FDFA;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-muted: #475569;
  --border: #CBD5E1;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  padding: 0 0 96px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Sarabun", "Noto Sans Thai", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
}

.app-container {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100vh;
}

.offline-strip {
  background: #E2E8F0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dot-green { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }

.topbar {
  background: var(--card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-bg);
  border: 2px solid var(--primary);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  min-height: 52px;
}

.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.profile-pill-info { text-align: left; line-height: 1.2; }
.profile-pill-name { font-weight: 800; font-size: 17px; color: var(--text); }
.profile-pill-sub { font-size: 13px; color: var(--primary-dark); font-weight: 600; }

.page-badge {
  background: #F1F5F9;
  color: var(--primary-dark);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
}

.main-content { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid #E2E8F0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.card-title { font-size: 19px; font-weight: 800; margin: 0; color: var(--text); }

/* Daily BP Check-in Slot Cards (Page 1 Core Feature) */
.slot-card {
  border: 2px solid #CBD5E1;
  border-radius: 16px;
  padding: 14px 16px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.slot-card.recorded {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.slot-card:active { transform: scale(0.99); }

.slot-left { flex: 1; }
.slot-label { font-size: 18px; font-weight: 800; color: var(--text); }
.slot-sub { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

.slot-right { text-align: right; }
.slot-bp-val { font-size: 26px; font-weight: 900; color: var(--primary-dark); line-height: 1.1; }
.slot-pulse-val { font-size: 14px; color: var(--text-muted); font-weight: 700; }

.btn-tap-record {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 800;
  min-height: 46px;
  cursor: pointer;
}

/* Status Badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800;
}
.status-normal { background: var(--success-light); color: #15803D; }
.status-elevated { background: var(--amber-light); color: #B45309; }
.status-high { background: var(--danger-light); color: #B91C1C; }

/* Buttons */
.btn-primary {
  width: 100%; background: var(--primary); color: #FFFFFF; border: none;
  border-radius: 16px; padding: 15px; font-size: 19px; font-weight: 800;
  cursor: pointer; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary {
  background: #F1F5F9; color: var(--text); border: 2px solid var(--border);
  border-radius: 14px; padding: 10px 14px; font-size: 16px; font-weight: 700; cursor: pointer; min-height: 46px;
}
.btn-amber {
  background: var(--amber); color: #FFFFFF; border: none;
  border-radius: 14px; padding: 12px; font-size: 17px; font-weight: 800; cursor: pointer; min-height: 50px; width: 100%;
}
.btn-danger-outline {
  background: #FFF; color: var(--danger); border: 1px solid #FCA5A5;
  border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 700; cursor: pointer;
}

/* Sliders */
.slider-group { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.slider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.slider-title { font-size: 17px; font-weight: 800; }
.slider-readout { font-size: 32px; font-weight: 900; color: var(--primary-dark); }
.slider-controls-row { display: flex; align-items: center; gap: 10px; }
.btn-step {
  width: 50px; height: 50px; border-radius: 12px; border: 2px solid var(--border);
  background: #FFF; font-size: 24px; font-weight: 900; cursor: pointer; flex-shrink: 0;
}
input[type="range"].big-slider {
  -webkit-appearance: none; width: 100%; height: 14px; border-radius: 999px; background: #CBD5E1; outline: none;
}
input[type="range"].big-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); border: 4px solid #FFF; box-shadow: 0 2px 8px rgba(0,0,0,0.3); cursor: pointer;
}

/* Lab Comparison Grid (Page 2) */
.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lab-metric-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 12px;
}
.lab-metric-name { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.lab-metric-val { font-size: 24px; font-weight: 900; color: var(--text); margin: 2px 0; }
.lab-delta { font-size: 13px; font-weight: 800; }
.delta-good { color: var(--success); }
.delta-warn { color: var(--danger); }
.delta-neutral { color: var(--text-muted); }

/* Bottom Multi-Page Navigation (Links to separate HTML files!) */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #FFFFFF; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 6px 4px; z-index: 50;
  max-width: 620px; margin: 0 auto;
}
.nav-link {
  flex: 1; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; color: var(--text-muted); font-size: 13px; font-weight: 800;
  border-radius: 12px;
}
.nav-link.active { color: var(--primary-dark); background: var(--primary-bg); }
.nav-icon { font-size: 22px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7);
  z-index: 100; display: none; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: #FFFFFF; width: 100%; max-width: 620px;
  border-radius: 24px 24px 0 0; padding: 20px; max-height: 92vh; overflow-y: auto;
}

.input-field {
  width: 100%; padding: 12px; font-size: 17px; font-weight: 700;
  border-radius: 12px; border: 2px solid var(--border); background: #FFF;
}

.hidden { display: none !important; }
