/* FerriHealth+ — Dark theme with energetic green/orange accents */

:root {
  --bg: #0a0a0c;
  --surface: #141418;
  --surface2: #1c1c22;
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f2;
  --text-muted: #8a8a96;
  --accent: #22c55e;
  --accent2: #f97316;
  --accent-glow: rgba(34,197,94,0.3);
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* === NAV === */
.health-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,12,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
  height: 56px;
  overflow-x: auto;
}
.nav-brand {
  font-weight: 700; font-size: 16px;
  white-space: nowrap; margin-right: 8px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text); background: var(--surface2);
}
.nav-link.active { color: var(--accent); }
.nav-external { display: flex; gap: 6px; }
.nav-pill {
  padding: 5px 10px; border-radius: 20px;
  background: var(--surface2); color: var(--text-muted);
  text-decoration: none; font-size: 11px; font-weight: 500;
  white-space: nowrap; transition: all 0.2s;
}
.nav-pill:hover { color: var(--text); background: var(--surface); }

/* === LAYOUT === */
main { max-width: 600px; margin: 0 auto; padding: 20px 16px 100px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }

/* === STREAK HERO === */
.streak-hero {
  text-align: center; padding: 32px 0 24px;
}
.streak-number {
  font-size: 72px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.streak-label { font-size: 18px; color: var(--text-muted); margin-top: 4px; }
.streak-sub { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

/* streak increment animation */
@keyframes streak-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.streak-number.pop { animation: streak-pop 0.4s ease; }

/* === ORB MESSAGE === */
.orb-message { display: flex; align-items: flex-start; gap: 12px; }
.orb-icon-sm { font-size: 24px; flex-shrink: 0; }
.orb-message p { font-size: 14px; line-height: 1.5; color: var(--text-muted); }

/* === WEEKLY CALENDAR === */
.weekly-calendar { display: flex; gap: 8px; }
.week-day {
  flex: 1; text-align: center; padding: 10px 4px;
  border-radius: var(--radius-sm); background: var(--surface2);
  font-size: 11px; font-weight: 600;
}
.week-day .day-label { color: var(--text-muted); margin-bottom: 4px; }
.week-day .day-dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin: 4px auto 0; background: var(--surface);
}
.week-day.completed .day-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.week-day.rest .day-dot { background: var(--accent2); }
.week-day.missed .day-dot { background: var(--danger); }
.week-day.today { border: 1px solid var(--accent); }

/* === BUTTONS === */
.btn-primary {
  display: inline-block; padding: 12px 24px; border-radius: var(--radius-sm);
  background: var(--accent); color: #000; font-weight: 700;
  font-size: 15px; border: none; cursor: pointer; text-decoration: none;
  transition: all 0.2s; text-align: center;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary {
  display: inline-block; padding: 12px 24px; border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--text); font-weight: 600;
  font-size: 15px; border: 1px solid var(--border); cursor: pointer;
  text-decoration: none; transition: all 0.2s; text-align: center;
}
.btn-secondary:hover { background: var(--surface); }
.btn-small {
  display: inline-block; padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--surface2); color: var(--text); font-weight: 500;
  font-size: 13px; border: 1px solid var(--border); cursor: pointer;
  text-decoration: none; transition: all 0.2s;
}
.btn-small:hover { background: var(--surface); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-large { display: block; width: 100%; padding: 16px; font-size: 17px; }
.btn-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover:not(:disabled) { background: var(--surface); }
.btn-icon:disabled { opacity: 0.3; cursor: default; }
.btn-finish {
  display: block; width: 100%; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000; font-weight: 800; font-size: 18px;
  border: none; cursor: pointer; margin-top: 20px;
  transition: all 0.2s;
}
.btn-finish:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* === QUICK ACTIONS === */
.quick-actions {
  display: flex; gap: 12px; margin-bottom: 16px;
}
.action-btn { flex: 1; text-align: center; }
.action-btn.primary { flex: 2; }

/* === STAT ROW === */
.stat-row { display: flex; gap: 12px; }
.stat-box {
  flex: 1; text-align: center; padding: 16px;
  background: var(--surface2); border-radius: var(--radius-sm);
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* === CHARTS === */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100% !important; height: auto !important; }
.no-data { text-align: center; color: var(--text-muted); font-size: 13px; padding: 20px; }

/* === HEIGHT TIMELINE === */
.height-entry {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.height-entry:last-child { border-bottom: none; }
.height-val { font-weight: 700; color: var(--accent); }
.height-date { color: var(--text-muted); font-size: 12px; }

/* === MODALS === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 360px;
}
.modal h3 { margin-bottom: 16px; color: var(--text); }
.modal-actions { display: flex; gap: 12px; margin-top: 16px; }

/* === INPUTS === */
.input-group {
  display: flex; align-items: center; gap: 8px; margin: 12px 0;
}
.input-group input, .form-group input {
  flex: 1; padding: 12px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 16px; outline: none;
}
.input-group input:focus, .form-group input:focus {
  border-color: var(--accent);
}
.input-unit { color: var(--text-muted); font-size: 14px; font-weight: 600; }
.input-time {
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 600;
}

/* === TOGGLE === */
.toggle-row { margin: 16px 0; }
.toggle-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; cursor: pointer; user-select: none;
}
.toggle-label input { display: none; }
.toggle-slider {
  width: 44px; height: 24px; background: var(--surface2);
  border-radius: 12px; position: relative; transition: all 0.2s;
  border: 1px solid var(--border); flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted); transition: all 0.2s;
}
.toggle-label input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-label input:checked + .toggle-slider::after { left: 22px; background: #000; }

/* === LOADING / SPINNER === */
.loading { text-align: center; padding: 30px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--surface2);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === ASSESSMENT === */
.assessment-container {
  max-width: 500px; margin: 0 auto; padding: 40px 20px;
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center;
}
.assessment-header { text-align: center; margin-bottom: 40px; }
.assessment-header h1 { font-size: 28px; margin-top: 16px; }
.assessment-header .subtitle { color: var(--text-muted); margin-top: 8px; font-size: 15px; }

.orb-icon { font-size: 48px; display: inline-block; }
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
}
.orb-icon.pulse { animation: pulse-glow 2s ease-in-out infinite; }

.quiz-step { display: none; }
.quiz-step.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.quiz-step h2 { font-size: 20px; text-align: center; margin-bottom: 24px; }
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.quiz-btn {
  padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 16px; cursor: pointer;
  text-align: center; transition: all 0.2s;
}
.quiz-btn:hover { border-color: var(--accent); }
.quiz-btn.selected { background: var(--accent); color: #000; border-color: var(--accent); }

.progress-dots { display: flex; justify-content: center; gap: 8px; margin-top: 30px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface2); transition: all 0.3s;
}
.dot.active { background: var(--accent); }

.result-card { text-align: center; }
.result-card h2 { margin: 16px 0 8px; }
.result-card .result-desc { color: var(--text-muted); margin-bottom: 24px; font-size: 15px; }

/* === SESSION PAGE === */
.generate-card { text-align: center; }
.generate-card h2 { margin: 12px 0 8px; }
.generate-card > p { color: var(--text-muted); margin-bottom: 20px; }
.weight-prompt { margin: 20px 0; text-align: left; }
.weight-prompt h3 { font-size: 14px; color: var(--text-muted); }

.plan-header { text-align: center; margin-bottom: 16px; }
.plan-header h2 { margin-bottom: 8px; }
.orb-intro { color: var(--accent); font-style: italic; font-size: 15px; }

.plan-overview { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.plan-tag {
  padding: 4px 12px; border-radius: 20px;
  background: var(--surface2); font-size: 12px;
  font-weight: 600; text-transform: uppercase;
  color: var(--text-muted);
}

.exercise-list .exercise-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
}
.exercise-item .ex-name { font-weight: 700; font-size: 15px; }
.exercise-item .ex-detail { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.exercise-item .ex-tip { color: var(--accent); font-size: 12px; margin-top: 6px; font-style: italic; }
.exercise-item .ex-section {
  font-size: 10px; text-transform: uppercase; font-weight: 700;
  color: var(--accent2); margin-bottom: 6px;
}

/* === ACTIVE SESSION === */
.session-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; position: sticky; top: 56px; z-index: 50;
  background: var(--bg);
}
.timer {
  font-size: 28px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.exercise-counter { font-size: 14px; color: var(--text-muted); font-weight: 600; }

.exercise-cards { position: relative; }
.exercise-card {
  display: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; text-align: center;
  min-height: 200px;
}
.exercise-card.active { display: block; animation: fadeIn 0.2s ease; }
.exercise-card.done { opacity: 0.5; }
.exercise-card .ec-section {
  font-size: 11px; text-transform: uppercase; font-weight: 700;
  color: var(--accent2); margin-bottom: 8px;
}
.exercise-card .ec-name { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.exercise-card .ec-detail { color: var(--text-muted); font-size: 15px; margin-bottom: 8px; }
.exercise-card .ec-equipment {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  background: var(--surface2); font-size: 11px; color: var(--text-muted);
  margin-bottom: 12px;
}
.exercise-card .ec-tip {
  color: var(--accent); font-size: 13px; font-style: italic;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px;
}
.exercise-card .ec-check {
  font-size: 32px; margin-top: 12px;
}

.session-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 20px;
}

/* === LOG PAGE === */
.log-page .page-desc { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: center; transition: all 0.2s;
}
.tab.active { background: var(--accent); color: #000; border-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s;
}
.upload-zone:hover { border-color: var(--accent); }
.upload-icon { font-size: 36px; margin-bottom: 8px; }

.confidence { font-size: 11px; margin-left: 8px; }
.confidence.high { color: var(--accent); }
.confidence.low { color: var(--danger); }

.ocr-note { color: var(--text-muted); font-size: 12px; margin-bottom: 16px; }

.success-msg {
  text-align: center; padding: 20px;
  background: rgba(34,197,94,0.1); border: 1px solid var(--accent);
  border-radius: var(--radius); margin-top: 16px;
}
.success-msg a { color: var(--accent); }

/* === PROGRESS PAGE === */
.session-history .sh-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.sh-item:last-child { border-bottom: none; }
.sh-date { color: var(--text-muted); font-size: 12px; }
.sh-type { font-weight: 600; text-transform: capitalize; }
.sh-status {
  padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.sh-status.completed { background: rgba(34,197,94,0.15); color: var(--accent); }
.sh-status.rest, .sh-status.busy { background: rgba(249,115,22,0.15); color: var(--accent2); }
.sh-status.planned { background: var(--surface2); color: var(--text-muted); }

/* === SETTINGS === */
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
}
.setting-row label { font-size: 14px; }
.settings-page .card { margin-bottom: 16px; }
.settings-page .card p { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }

/* === DONE CARD === */
.done-card { text-align: center; }
.done-icon { font-size: 64px; margin-bottom: 12px; }
.done-card h2 { margin-bottom: 8px; }
.done-card p { color: var(--text-muted); margin-bottom: 20px; }
.done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === ORB CHAT WIDGET === */
.orb-chat-bubble {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; cursor: pointer; box-shadow: 0 4px 20px var(--accent-glow);
  animation: pulse-glow 2s ease-in-out infinite;
  border: none;
}
.orb-chat-panel {
  position: fixed; bottom: 86px; right: 20px; z-index: 300;
  width: 340px; max-height: 480px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: none; flex-direction: column;
}
.orb-chat-panel.open { display: flex; }
.orb-chat-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.orb-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px; min-height: 200px;
  max-height: 340px;
}
.orb-chat-msg {
  margin-bottom: 10px; font-size: 13px; line-height: 1.5;
  padding: 8px 12px; border-radius: var(--radius-sm);
  max-width: 85%;
}
.orb-chat-msg.user { background: var(--accent); color: #000; margin-left: auto; }
.orb-chat-msg.orb { background: var(--surface2); color: var(--text); }
.orb-chat-input {
  display: flex; gap: 8px; padding: 12px;
  border-top: 1px solid var(--border);
}
.orb-chat-input input {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; outline: none;
}
.orb-chat-input button {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #000; font-weight: 700;
  border: none; cursor: pointer; font-size: 13px;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .health-nav { padding: 0 8px; }
  .nav-link { padding: 8px 8px; font-size: 12px; }
  .nav-brand { font-size: 14px; }
  .nav-external { display: none; }
  main { padding: 16px 12px 100px; }
  .streak-number { font-size: 56px; }
  .weekly-calendar { gap: 4px; }
  .week-day { padding: 8px 2px; font-size: 10px; }
  .stat-value { font-size: 22px; }
  .orb-chat-panel { right: 10px; left: 10px; width: auto; }
}
