/* HealthPulse — Dark Glassmorphism Theme */
:root {
  --bg: #0a0d12;
  --bg2: #111827;
  --bg3: #1f2937;
  --surface: rgba(255,255,255,0.05);
  --surface2: rgba(255,255,255,0.08);
  --surface3: rgba(255,255,255,0.12);
  --teal: #58d3b7;
  --health-green: #4ade80;
  --health-blue: #60a5fa;
  --health-purple: #a78bfa;
  --health-pink: #f472b6;
  --health-orange: #fb923c;
  --health-red: #f87171;
  --health-yellow: #fbbf24;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --border: rgba(255,255,255,0.1);
  --glass: rgba(15,23,42,0.8);
  --glass2: rgba(15,23,42,0.6);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; scroll-behavior:smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== LANDING PAGE ===== */
.landing-bg {
  position: fixed; inset:0; z-index:0;
  background: radial-gradient(ellipse at 20% 50%, rgba(74,222,128,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(96,165,250,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(167,139,250,0.06) 0%, transparent 50%),
              var(--bg);
}
.landing-container {
  position: relative; z-index:1;
  min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:2rem;
}
.landing-hero { text-align:center; max-width:600px; margin-bottom:2rem; }
.landing-logo {
  font-size:3rem; font-weight:800; letter-spacing:-1px;
  background: linear-gradient(135deg, var(--health-green), var(--health-blue));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  margin-bottom:0.5rem;
}
.landing-tagline { color:var(--text2); font-size:1.15rem; line-height:1.6; margin-bottom:2.5rem; }

/* Animated stats */
.landing-stats {
  display:grid; grid-template-columns:repeat(2,1fr); gap:1rem;
  margin-bottom:2.5rem; width:100%; max-width:500px;
}
.stat-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align:center;
  transition: transform 0.3s, border-color 0.3s;
}
.stat-card:hover { transform:translateY(-2px); border-color:var(--health-green); }
.stat-value {
  font-size:1.75rem; font-weight:700;
  background: linear-gradient(135deg, var(--health-green), var(--teal));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
}
.stat-label { font-size:0.8rem; color:var(--text3); margin-top:0.25rem; text-transform:uppercase; letter-spacing:0.5px; }

/* Login card */
.login-card {
  background: var(--glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width:100%; max-width:400px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 { font-size:1.25rem; margin-bottom:1.5rem; text-align:center; }
.form-group { margin-bottom:1rem; }
.form-group label { display:block; font-size:0.8rem; color:var(--text2); margin-bottom:0.4rem; text-transform:uppercase; letter-spacing:0.5px; }
.form-input {
  width:100%; padding:0.75rem 1rem; font-size:1rem;
  background: var(--surface2); border:1px solid var(--border);
  border-radius: var(--radius-sm); color:var(--text);
  transition: border-color 0.3s, box-shadow 0.3s;
  outline:none;
}
.form-input:focus { border-color:var(--health-green); box-shadow:0 0 0 3px rgba(74,222,128,0.15); }
.form-input::placeholder { color:var(--text3); }

.btn-primary {
  width:100%; padding:0.85rem; font-size:1rem; font-weight:600;
  background: linear-gradient(135deg, var(--health-green), var(--teal));
  color:#0a0d12; border:none; border-radius:var(--radius-sm);
  cursor:pointer; transition: transform 0.2s, box-shadow 0.2s;
  margin-top:0.5rem;
}
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 4px 20px rgba(74,222,128,0.3); }
.btn-primary:active { transform:scale(0.98); }

.btn-secondary {
  padding:0.6rem 1.2rem; font-size:0.9rem; font-weight:500;
  background:var(--surface2); color:var(--text);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  cursor:pointer; transition: all 0.2s;
}
.btn-secondary:hover { background:var(--surface3); border-color:var(--health-green); }

.lang-toggle {
  position:absolute; top:1.5rem; right:1.5rem;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-xs); padding:0.4rem 0.8rem;
  color:var(--text2); font-size:0.85rem; cursor:pointer;
  transition: all 0.2s; z-index:10;
}
.lang-toggle:hover { color:var(--text); border-color:var(--health-green); }

/* Particles */
.particle {
  position:fixed; border-radius:50%; pointer-events:none; opacity:0;
  animation: particleFloat 8s infinite;
}
@keyframes particleFloat {
  0% { opacity:0; transform:translateY(100vh) scale(0); }
  10% { opacity:0.6; }
  90% { opacity:0.6; }
  100% { opacity:0; transform:translateY(-100px) scale(1); }
}

/* ===== APP LAYOUT ===== */
.app-container {
  display:flex; flex-direction:column; min-height:100vh;
  background: var(--bg);
}
.app-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:0.75rem 1rem;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:100;
}
.app-header-brand {
  font-size:1.1rem; font-weight:700;
  background: linear-gradient(135deg, var(--health-green), var(--health-blue));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
}
.app-header-xp {
  display:flex; align-items:center; gap:0.5rem;
  font-size:0.85rem; color:var(--text2);
}
.xp-mini-bar {
  width:60px; height:6px; background:var(--surface2);
  border-radius:3px; overflow:hidden;
}
.xp-mini-fill {
  height:100%; background:linear-gradient(90deg, var(--health-green), var(--teal));
  border-radius:3px; transition:width 0.5s ease;
}

.app-content {
  flex:1; padding:1rem; padding-bottom:5rem;
  max-width:600px; margin:0 auto; width:100%;
}

/* Tab content */
.tab-page { display:none; animation: fadeSlideIn 0.3s ease; }
.tab-page.active { display:block; }
@keyframes fadeSlideIn {
  from { opacity:0; transform:translateY(10px); }
  to { opacity:1; transform:translateY(0); }
}

/* Bottom nav */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0;
  display:flex; justify-content:space-around;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-top:1px solid var(--border);
  padding:0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  z-index:100;
}
.nav-item {
  display:flex; flex-direction:column; align-items:center;
  padding:0.35rem 0.5rem; cursor:pointer; transition:all 0.2s;
  color:var(--text3); font-size:0.65rem; gap:0.2rem;
  border:none; background:none; min-width:56px;
}
.nav-item svg { width:22px; height:22px; }
.nav-item.active { color:var(--health-green); }
.nav-item:hover { color:var(--text); }

/* ===== CARDS ===== */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:1.25rem;
  margin-bottom:1rem;
  transition: transform 0.2s;
}
.card:hover { transform:translateY(-1px); }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.75rem; }
.card-title { font-size:0.95rem; font-weight:600; color:var(--text); }
.card-subtitle { font-size:0.75rem; color:var(--text3); }

/* ===== HEALTH SCORE RING ===== */
.health-ring-wrap { display:flex; justify-content:center; margin:1rem 0; }
.health-ring { position:relative; width:160px; height:160px; }
.health-ring svg { width:100%; height:100%; transform:rotate(-90deg); }
.health-ring-bg { fill:none; stroke:var(--surface2); stroke-width:8; }
.health-ring-fill {
  fill:none; stroke:url(#healthGradient); stroke-width:8;
  stroke-linecap:round; transition: stroke-dashoffset 1.5s ease;
}
.health-ring-text {
  position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
}
.health-ring-value { font-size:2.5rem; font-weight:800; color:var(--health-green); }
.health-ring-label { font-size:0.75rem; color:var(--text3); text-transform:uppercase; letter-spacing:1px; }

/* ===== XP BAR ===== */
.xp-bar-wrap { margin:1rem 0; }
.xp-bar-header { display:flex; justify-content:space-between; margin-bottom:0.4rem; }
.xp-bar-level { font-size:0.85rem; font-weight:600; color:var(--health-green); }
.xp-bar-label { font-size:0.75rem; color:var(--text3); }
.xp-bar {
  width:100%; height:10px; background:var(--surface2);
  border-radius:5px; overflow:hidden;
}
.xp-bar-fill {
  height:100%; border-radius:5px;
  background: linear-gradient(90deg, var(--health-green), var(--health-blue), var(--health-purple));
  transition: width 1s ease;
}

/* ===== STREAK ===== */
.streak-badge {
  display:inline-flex; align-items:center; gap:0.4rem;
  background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(251,146,60,0.15));
  border:1px solid rgba(251,191,36,0.3);
  border-radius:20px; padding:0.35rem 0.85rem;
  font-size:0.85rem; font-weight:600; color:var(--health-yellow);
}

/* ===== QUICK ACTIONS ===== */
.quick-actions { display:grid; grid-template-columns:repeat(3,1fr); gap:0.75rem; margin:1rem 0; }
.quick-action {
  display:flex; flex-direction:column; align-items:center; gap:0.5rem;
  padding:1rem 0.5rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
  cursor:pointer; transition:all 0.2s; color:var(--text);
  text-decoration:none; font-size:0.8rem; text-align:center;
}
.quick-action:hover { background:var(--surface2); border-color:var(--health-green); transform:translateY(-2px); }
.quick-action-icon { font-size:1.5rem; }

/* ===== ACTIVITY FEED ===== */
.activity-item {
  display:flex; align-items:center; gap:0.75rem;
  padding:0.75rem 0; border-bottom:1px solid var(--border);
}
.activity-item:last-child { border-bottom:none; }
.activity-icon {
  width:36px; height:36px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-size:1rem; flex-shrink:0;
}
.activity-icon.green { background:rgba(74,222,128,0.15); }
.activity-icon.blue { background:rgba(96,165,250,0.15); }
.activity-icon.purple { background:rgba(167,139,250,0.15); }
.activity-icon.orange { background:rgba(251,146,60,0.15); }
.activity-text { font-size:0.85rem; color:var(--text2); }
.activity-text strong { color:var(--text); }
.activity-time { font-size:0.7rem; color:var(--text3); margin-top:0.15rem; }

/* ===== WIZARD ===== */
.wizard-progress {
  display:flex; gap:0.25rem; margin-bottom:1.5rem;
}
.wizard-step-dot {
  flex:1; height:4px; border-radius:2px;
  background:var(--surface2); transition: background 0.3s;
}
.wizard-step-dot.active { background:var(--health-green); }
.wizard-step-dot.done { background:var(--teal); }
.wizard-step { display:none; animation:fadeSlideIn 0.3s ease; }
.wizard-step.active { display:block; }

/* Visit type selector */
.visit-types { display:grid; grid-template-columns:repeat(2,1fr); gap:0.75rem; }
.visit-type-btn {
  display:flex; flex-direction:column; align-items:center; gap:0.5rem;
  padding:1.25rem; background:var(--surface);
  border:2px solid var(--border); border-radius:var(--radius);
  cursor:pointer; transition:all 0.3s; color:var(--text);
  font-size:0.85rem;
}
.visit-type-btn:hover { border-color:var(--health-green); background:var(--surface2); }
.visit-type-btn.selected { border-color:var(--health-green); background:rgba(74,222,128,0.1); }
.visit-type-btn .icon { font-size:2rem; }

/* Star rating */
.star-rating { display:flex; gap:0.25rem; }
.star-rating .star {
  font-size:1.75rem; cursor:pointer; color:var(--text3);
  transition: color 0.2s, transform 0.2s;
}
.star-rating .star:hover, .star-rating .star.active { color:var(--health-yellow); }
.star-rating .star:hover { transform:scale(1.15); }
.rating-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.rating-label { font-size:0.85rem; color:var(--text2); max-width:45%; }

/* Autocomplete */
.autocomplete-wrap { position:relative; }
.autocomplete-list {
  position:absolute; top:100%; left:0; right:0;
  background:var(--bg2); border:1px solid var(--border);
  border-radius:var(--radius-sm); max-height:200px; overflow-y:auto;
  z-index:50; display:none;
}
.autocomplete-list.show { display:block; }
.autocomplete-item {
  padding:0.65rem 1rem; cursor:pointer; font-size:0.9rem;
  transition: background 0.15s;
}
.autocomplete-item:hover { background:var(--surface2); }

/* ===== CELEBRATION ===== */
.celebration-overlay {
  position:fixed; inset:0; z-index:200;
  background:rgba(0,0,0,0.7); backdrop-filter:blur(10px);
  display:none; align-items:center; justify-content:center;
  animation: fadeIn 0.3s;
}
.celebration-overlay.show { display:flex; }
.celebration-card {
  background:var(--glass); backdrop-filter:blur(24px);
  border:1px solid var(--health-green); border-radius:var(--radius);
  padding:2.5rem; text-align:center; max-width:360px;
  box-shadow:0 0 60px rgba(74,222,128,0.2);
  animation: scaleIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes scaleIn { from { transform:scale(0.8); opacity:0; } to { transform:scale(1); opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.celebration-emoji { font-size:4rem; margin-bottom:1rem; animation: bounce 0.6s ease; }
@keyframes bounce { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-20px); } }
.celebration-xp {
  font-size:2rem; font-weight:800;
  background:linear-gradient(135deg,var(--health-green),var(--health-blue));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  margin:0.5rem 0;
}
.celebration-msg { color:var(--text2); font-size:0.9rem; margin-bottom:1.5rem; }

/* ===== INSIGHTS ===== */
.insight-toggle {
  display:flex; gap:0; margin-bottom:1rem;
  background:var(--surface); border-radius:var(--radius-sm); overflow:hidden;
  border:1px solid var(--border);
}
.insight-toggle-btn {
  flex:1; padding:0.6rem; text-align:center; font-size:0.85rem;
  cursor:pointer; transition:all 0.2s; background:none;
  color:var(--text3); border:none;
}
.insight-toggle-btn.active {
  background:var(--health-green); color:var(--bg);
  font-weight:600;
}
.chart-wrap { position:relative; height:250px; margin:1rem 0; }
.chart-wrap canvas { width:100%!important; height:100%!important; }

.insight-stat {
  display:flex; align-items:center; gap:1rem;
  padding:0.75rem 0; border-bottom:1px solid var(--border);
}
.insight-stat:last-child { border-bottom:none; }
.insight-stat-icon { font-size:1.5rem; width:40px; text-align:center; }
.insight-stat-value { font-size:1.1rem; font-weight:700; color:var(--health-green); }
.insight-stat-label { font-size:0.75rem; color:var(--text3); }

.didyouknow {
  background: linear-gradient(135deg, rgba(96,165,250,0.1), rgba(167,139,250,0.1));
  border:1px solid rgba(96,165,250,0.2);
  border-radius:var(--radius); padding:1rem;
  margin:0.75rem 0; font-size:0.85rem; color:var(--text2);
  line-height:1.5;
}
.didyouknow::before { content:'💡 '; }

/* ===== BADGES ===== */
.badges-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0.75rem; }
.badge-item {
  display:flex; flex-direction:column; align-items:center;
  padding:1rem 0.5rem; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
  text-align:center; transition:all 0.3s;
}
.badge-item.earned { border-color:var(--health-yellow); background:rgba(251,191,36,0.08); }
.badge-item.locked { opacity:0.4; filter:grayscale(1); }
.badge-icon { font-size:2rem; margin-bottom:0.4rem; }
.badge-name { font-size:0.7rem; color:var(--text2); }

/* Leaderboard */
.lb-item {
  display:flex; align-items:center; gap:0.75rem;
  padding:0.75rem; margin-bottom:0.5rem;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); transition:all 0.2s;
}
.lb-item:first-child { border-color:var(--health-yellow); background:rgba(251,191,36,0.05); }
.lb-rank {
  width:28px; height:28px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:0.8rem; font-weight:700; background:var(--surface2);
  color:var(--text2); flex-shrink:0;
}
.lb-item:nth-child(1) .lb-rank { background:linear-gradient(135deg,#fbbf24,#f59e0b); color:#0a0d12; }
.lb-item:nth-child(2) .lb-rank { background:linear-gradient(135deg,#94a3b8,#64748b); color:#0a0d12; }
.lb-item:nth-child(3) .lb-rank { background:linear-gradient(135deg,#fb923c,#ea580c); color:#0a0d12; }
.lb-name { flex:1; font-size:0.9rem; font-weight:500; }
.lb-xp { font-size:0.8rem; color:var(--health-green); font-weight:600; }

/* ===== CHECK-IN ===== */
.emoji-selector { display:flex; gap:0.5rem; justify-content:center; margin:1rem 0; }
.emoji-btn {
  font-size:2rem; cursor:pointer; padding:0.5rem;
  border:2px solid transparent; border-radius:var(--radius-sm);
  transition:all 0.2s; background:none;
}
.emoji-btn:hover { transform:scale(1.15); }
.emoji-btn.selected { border-color:var(--health-green); background:rgba(74,222,128,0.1); transform:scale(1.1); }

.slider-group { margin:1rem 0; }
.slider-group label { display:flex; justify-content:space-between; margin-bottom:0.4rem; }
.slider-group label span:first-child { font-size:0.85rem; color:var(--text2); }
.slider-group label span:last-child { font-size:0.85rem; font-weight:600; color:var(--health-green); }
input[type="range"] {
  width:100%; height:6px; -webkit-appearance:none; appearance:none;
  background:var(--surface2); border-radius:3px; outline:none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance:none; width:20px; height:20px;
  background:var(--health-green); border-radius:50%;
  cursor:pointer; border:2px solid var(--bg);
  box-shadow:0 2px 8px rgba(74,222,128,0.3);
}

.toggle-wrap {
  display:flex; align-items:center; justify-content:space-between;
  padding:0.75rem 0;
}
.toggle-label { font-size:0.9rem; color:var(--text2); }
.toggle {
  width:48px; height:26px; border-radius:13px;
  background:var(--surface2); cursor:pointer;
  position:relative; transition:background 0.3s;
  border:none;
}
.toggle.on { background:var(--health-green); }
.toggle::after {
  content:''; position:absolute; top:3px; left:3px;
  width:20px; height:20px; border-radius:50%;
  background:white; transition:transform 0.3s;
}
.toggle.on::after { transform:translateX(22px); }

/* ===== PROFILE ===== */
.avatar-wrap {
  display:flex; justify-content:center; margin:1.5rem 0;
}
.avatar {
  width:80px; height:80px; border-radius:50%;
  background:linear-gradient(135deg, var(--health-green), var(--health-blue));
  display:flex; align-items:center; justify-content:center;
  font-size:2.5rem; color:var(--bg);
  border:3px solid var(--border);
}

/* Section titles */
.section-title {
  font-size:0.75rem; color:var(--text3); text-transform:uppercase;
  letter-spacing:1px; margin:1.5rem 0 0.75rem;
}

/* ===== CONFETTI ===== */
.confetti-piece {
  position:fixed; z-index:300; pointer-events:none;
  animation: confettiFall 3s ease-out forwards;
}
@keyframes confettiFall {
  0% { opacity:1; transform:translateY(-20px) rotate(0deg); }
  100% { opacity:0; transform:translateY(100vh) rotate(720deg); }
}

/* ===== RESPONSIVE ===== */
@media(min-width:640px) {
  .landing-stats { grid-template-columns:repeat(4,1fr); }
  .visit-types { grid-template-columns:repeat(3,1fr); }
  .badges-grid { grid-template-columns:repeat(5,1fr); }
}

/* Scrollbar */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:3px; }

/* Textarea */
textarea.form-input { resize:vertical; min-height:80px; font-family:inherit; }

/* Select */
select.form-input { appearance:none; cursor:pointer; }

/* Pulse animation */
@keyframes pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.05); } }
.pulse { animation: pulse 2s infinite; }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size:200% 100%; animation: shimmer 1.5s infinite; border-radius:var(--radius-sm); }
@keyframes shimmer { 0% { background-position:200% 0; } 100% { background-position:-200% 0; } }

/* Survey sections */
.survey-section { margin-bottom:1.5rem; }
.survey-section h3 { font-size:1rem; font-weight:600; margin-bottom:0.75rem; color:var(--text); }
