/* ---- Landing Hero (Full Screen) ---- */
.landing-hero {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stone-50);
}

.landing-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.landing-enter-btn {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 40px;
  background: rgba(45, 77, 50, 0.85);
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 30px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  letter-spacing: 2px;
}

.landing-enter-btn:hover {
  background: rgba(45, 77, 50, 0.95);
  border-color: rgba(255,255,255,0.5);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ============================================
   Selah Health â Design System
   Color: Sage Green + Warm Stone
   Typography: Inter + Noto Sans SC
   ============================================ */

:root {
  --sage-50: #f0f5f0;
  --sage-100: #dce8dc;
  --sage-200: #b8d1b8;
  --sage-300: #8fb98f;
  --sage-400: #6a9e6a;
  --sage-500: #4a7c4a;
  --sage-600: #3a6340;
  --sage-700: #2d4d32;

  --stone-50: #faf9f7;
  --stone-100: #f3f1ed;
  --stone-200: #e8e4dd;
  --stone-300: #d4cfc5;
  --stone-400: #b5ad9e;

  --text-primary: #1a1a1a;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --white: #ffffff;
  --bg: #f7f6f3;

  --danger: #c0392b;
  --warning: #d4a017;
  --success: #27ae60;
  --info: #2980b9;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Screen Management ---- */
.screen { display: none; }
.screen.active { display: block; }
.page { display: none; padding: 24px 32px 60px; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; }

/* ---- Auth Screen ---- */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--sage-50) 0%, var(--stone-50) 50%, var(--sage-100) 100%);
  padding: 24px;
}

/* ---- Hero Section ---- */
.hero-section {
  width: 100%;
  max-width: 720px;
  margin-bottom: 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-image {
  width: 100%;
  height: auto;
  display: block;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--sage-700);
  letter-spacing: -0.5px;
}

.brand-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 300;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--stone-200);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.auth-tab.active {
  color: var(--sage-600);
  border-bottom-color: var(--sage-500);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--stone-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--white);
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sage-400);
  box-shadow: 0 0 0 3px rgba(74,124,74,0.1);
}

.form-group input.readonly {
  background: var(--stone-50);
  color: var(--text-muted);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--sage-500);
  color: var(--white);
}

.btn-primary:hover { background: var(--sage-600); }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
}

.btn-ghost:hover { background: var(--stone-100); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; }

/* ---- Top Navigation ---- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--stone-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon-sm { font-size: 22px; }

.nav-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--sage-700);
}

.nav-center {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover { background: var(--stone-100); color: var(--text-primary); }
.nav-link.active { background: var(--sage-50); color: var(--sage-600); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.date-range-picker,
.record-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range-picker input,
.record-date-nav input {
  padding: 6px 10px;
  border: 1.5px solid var(--stone-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}

/* ---- Dashboard Grid ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.dash-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dash-card-wide {
  grid-column: span 3;
}

.card-header {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sage-700);
  border-bottom: 1px solid var(--stone-100);
  background: var(--sage-50);
}

.card-icon { margin-right: 6px; }

.card-body {
  padding: 18px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--stone-50);
  font-size: 13px;
}

.stat-row:last-child { border-bottom: none; }

.stat-label { color: var(--text-secondary); }

.stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

.stat-value.good { color: var(--success); }
.stat-value.warn { color: var(--warning); }
.stat-value.bad { color: var(--danger); }

/* Progress bar for supplement compliance */
.progress-bar {
  height: 6px;
  background: var(--stone-100);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--sage-400);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ---- Record Form ---- */
.record-form {
  max-width: 900px;
}

.record-section {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-title {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--sage-700);
  background: var(--sage-50);
  border-bottom: 1px solid var(--sage-100);
}

.section-title span { margin-right: 8px; }

.form-row {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.form-row .fg-wide { flex: 2; min-width: 250px; }
.form-row .fg-full { flex: 100%; min-width: 100%; }
.form-row .fg-check { flex: 0 0 60px; min-width: 60px; text-align: center; }
.form-row .fg-check input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--sage-500); }

.meal-group { border-bottom: 1px solid var(--stone-50); }
.meal-group:last-child { border-bottom: none; }
.meal-group h4 { padding: 10px 20px 0; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Supplement grid */
.supplement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px 20px;
}

.supp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--stone-50);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
}

.supp-item:hover { background: var(--sage-50); }
.supp-item input { accent-color: var(--sage-500); width: 16px; height: 16px; }
.supp-item input:checked + span { color: var(--sage-600); font-weight: 500; }

/* Form actions */
.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}

.save-status {
  font-size: 13px;
  color: var(--success);
}

/* ---- History Table ---- */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table-wrap th {
  padding: 10px 12px;
  background: var(--sage-50);
  color: var(--sage-700);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--sage-100);
  position: sticky;
  top: 0;
}

.table-wrap td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--stone-50);
  white-space: nowrap;
}

.table-wrap tr:hover td { background: var(--sage-50); }

.placeholder-text {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--sage-700);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error { background: var(--danger); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-card-wide { grid-column: span 2; }
  .supplement-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .top-nav { padding: 0 16px; }
  .nav-center { display: none; }
  .page { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-card-wide { grid-column: span 1; }
  .supplement-grid { grid-template-columns: 1fr 1fr; }
  .form-row .form-group { min-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }

  /* Mobile bottom nav */
  .top-nav::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--white);
    border-top: 1px solid var(--stone-200);
    z-index: 99;
  }
}