/* ===================================================
   KoruHealth App CSS
   Owns: onboarding form, timeline page, nav, app UI.
   Does NOT own: landing page sections (theme.css handles those).
   =================================================== */

/* === NAV === */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* === BUTTONS === */
.btn-primary {
  display: inline-block;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s, transform 0.15s;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

/* === ONBOARDING PAGE === */
.onboard-page {
  min-height: calc(100vh - 57px);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 60%);
  padding: 60px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.onboard-inner {
  width: 100%;
  max-width: 480px;
}

.onboard-header {
  text-align: center;
  margin-bottom: 36px;
}

.onboard-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 16px 0 12px;
  color: var(--fg);
}

.onboard-sub {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.onboard-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
}

.form-input,
.form-select {
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6560' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* Radio options for sex */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-option {
  cursor: pointer;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.radio-option input[type="radio"]:checked + .radio-label {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.radio-icon {
  font-size: 1.1rem;
}

.onboard-privacy {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-align: center;
  line-height: 1.5;
}

/* === TIMELINE PAGE === */
.timeline-page {
  min-height: calc(100vh - 57px);
  background: var(--bg);
  padding: 32px 24px 80px;
}

.timeline-page-inner {
  max-width: 720px;
  margin: 0 auto;
}

/* Profile bar */
.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  flex-wrap: wrap;
}

.profile-sep {
  color: var(--border);
}

.profile-edit-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-display);
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card.stat-due {
  border-color: var(--accent);
  background: var(--accent-light);
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

.stat-due .stat-number {
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-display);
}

/* Progress bar */
.progress-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  font-family: var(--font-display);
  white-space: nowrap;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Timeline list */
.tl-list {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tl-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* Timeline item */
.tl-item {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 12px;
}

/* Vertical connector line between items */
.tl-item:not(:last-child) .tl-gutter::after {
  content: '';
  position: absolute;
  left: 10px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.tl-gutter {
  position: relative;
  width: 22px;
  flex-shrink: 0;
  padding-top: 14px;
}

.tl-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.tl-dot--due {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.tl-dot--upcoming {
  background: var(--bg);
  border-color: var(--fg-muted);
}

.tl-dot--done {
  background: #16a34a;
  border-color: #16a34a;
  font-size: 0.65rem;
}

.tl-dot--future {
  background: var(--bg);
  border-color: var(--border);
}

/* Card */
.tl-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  margin-bottom: 12px;
}

.tl-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.tl-item--due .tl-card {
  border-left: 3px solid var(--accent);
}

.tl-item--done .tl-card {
  border-left: 3px solid #16a34a;
  opacity: 0.75;
}

.tl-card-header {}

.tl-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tl-when {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-muted);
}

.tl-when--due { color: var(--accent); }
.tl-when--done { color: #16a34a; }

.tl-type-badge {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-alt);
  color: var(--fg-muted);
}

.tl-type--vaccine { background: #fef3c7; color: #d97706; }
.tl-type--screening { background: #e0f2fe; color: #0369a1; }
.tl-type--checkin { background: var(--accent-light); color: var(--accent-dark); }

.tl-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tl-title {
  font-family: var(--font-display);
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
}

.tl-chevron {
  font-size: 1.2rem;
  color: var(--border);
  flex-shrink: 0;
  transition: transform 0.2s;
  line-height: 1;
  margin-top: 2px;
}

.tl-item.expanded .tl-chevron {
  transform: rotate(90deg);
}

.tl-source {
  font-size: 0.72rem;
  color: var(--fg-muted);
  font-family: var(--font-display);
  margin-top: 4px;
  display: block;
}

/* Detail panel (hidden until expanded) */
.tl-detail {
  display: none;
  padding-top: 16px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.tl-item.expanded .tl-detail {
  display: block;
}

.tl-description {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.65;
  margin-bottom: 16px;
}

.tl-why {
  background: var(--accent-light);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.tl-why-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin-bottom: 6px;
}

.tl-why p {
  font-size: 0.88rem;
  color: var(--fg);
  line-height: 1.65;
}

.tl-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tl-meta-pill {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--bg-alt);
  border-radius: 100px;
  padding: 3px 10px;
}

.tl-source-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-display);
  margin-left: auto;
}

.tl-source-link:hover { text-decoration: underline; }

/* === CTA IN LANDING HERO === */
.hero-cta {
  margin-top: 36px;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
  .app-nav { padding: 14px 20px; }
  .onboard-form { padding: 24px 20px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .stat-number { font-size: 1.5rem; }
  .tl-card { padding: 14px 16px; }
  .profile-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-tabs { gap: 6px; }
  .tab-btn { padding: 6px 12px; font-size: 0.75rem; }
}
