/* ============================================================
   VITALMETRICS — WELLNESS DASHBOARD
   Premium UI/UX Stylesheet
   ============================================================ */

/* ─── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Brand palette */
  --blue-500:   #3b82f6;
  --blue-600:   #2563eb;
  --blue-700:   #1d4ed8;
  --cyan-400:   #22d3ee;
  --cyan-500:   #06b6d4;
  --teal-500:   #14b8a6;
  --green-400:  #4ade80;
  --green-500:  #22c55e;
  --green-600:  #16a34a;
  --yellow-400: #facc15;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --red-400:    #f87171;
  --red-500:    #ef4444;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Gradients */
  --grad-brand:  linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --grad-hero:   linear-gradient(135deg, #1e3a5f 0%, #0e7490 60%, #0f766e 100%);
  --grad-bmi:    linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --grad-tdee:   linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  --grad-lose:   linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  --grad-maintain: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --grad-gain:   linear-gradient(135deg, #22c55e 0%, #14b8a6 100%);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.12);
  --shadow-blue: 0 8px 24px rgba(59,130,246,0.30);
  --shadow-orange: 0 8px 24px rgba(249,115,22,0.30);

  /* Spacing & Shape */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* Transitions */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   150ms;
  --dur-base:   250ms;
  --dur-slow:   400ms;
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(59,130,246,0.35));
}

.brand-logo svg { width: 100%; height: 100%; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.brand-tagline {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-600);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--green-500);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  background: var(--grad-hero);
  position: relative;
  overflow: hidden;
  padding: 4rem 1.5rem 3.5rem;
  text-align: center;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.65;
  font-weight: 400;
  max-width: 500px;
  margin: 0 auto;
}

/* Decorative circles */
.hero-decoration { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.deco-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.deco-1 { width: 400px; height: 400px; top: -150px; right: -100px; }
.deco-2 { width: 250px; height: 250px; bottom: -80px; left: -60px; }
.deco-3 { width: 150px; height: 150px; top: 20px; left: 30%; animation: float 6s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

/* ─── Dashboard Layout ───────────────────────────────────── */
.dashboard {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* ─── Panel (Card) ───────────────────────────────────────── */
.panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid rgba(226,232,240,0.6);
  transition: box-shadow var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.panel-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.bmi-icon  { background: var(--grad-bmi);  box-shadow: var(--shadow-blue); }
.tdee-icon { background: var(--grad-tdee); box-shadow: var(--shadow-orange); }

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.3px;
}

.panel-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.15rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ─── Form Elements ──────────────────────────────────────── */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.field-label svg {
  color: var(--gray-400);
  flex-shrink: 0;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input[type="number"],
.input-wrapper select {
  width: 100%;
  padding: 0.7rem 3rem 0.7rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--gray-800);
  background: var(--gray-50);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

.input-wrapper input[type="number"]::placeholder {
  color: var(--gray-300);
  font-weight: 400;
}

.input-wrapper input[type="number"]:hover,
.input-wrapper select:hover {
  border-color: var(--gray-300);
  background: #fff;
}

.input-wrapper input[type="number"]:focus,
.input-wrapper select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  background: #fff;
}

.input-unit {
  position: absolute;
  right: 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-400);
  pointer-events: none;
  user-select: none;
}

/* Select custom arrow */
.select-wrapper select {
  padding-right: 2.5rem;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 0.75rem;
  color: var(--gray-400);
  pointer-events: none;
}

/* ─── Buttons ────────────────────────────────────────────── */
.calc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease),
              filter var(--dur-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.calc-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--dur-fast) var(--ease);
}

.calc-btn:hover::after { background: rgba(255,255,255,0.08); }
.calc-btn:active::after { background: rgba(0,0,0,0.06); }

.calc-btn:hover {
  transform: translateY(-2px);
}

.calc-btn:active {
  transform: translateY(0) scale(0.99);
}

.bmi-btn {
  background: var(--grad-bmi);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}

.bmi-btn:hover  { box-shadow: 0 8px 24px rgba(59,130,246,0.45); }
.bmi-btn:active { box-shadow: 0 2px 8px rgba(59,130,246,0.25); }

.tdee-btn {
  background: var(--grad-tdee);
  box-shadow: 0 4px 16px rgba(249,115,22,0.35);
}

.tdee-btn:hover  { box-shadow: 0 8px 24px rgba(249,115,22,0.45); }
.tdee-btn:active { box-shadow: 0 2px 8px rgba(249,115,22,0.25); }

/* ─── Result Panel ───────────────────────────────────────── */
.result-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-100);
  animation: slideUp var(--dur-slow) var(--ease-spring);
}

.result-panel.hidden { display: none; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── IMC Ring Score ─────────────────────────────────────── */
.result-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.imc-score-ring {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.ring-bg {
  fill: none;
  stroke: var(--gray-100);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s var(--ease-spring),
              stroke 0.4s var(--ease);
}

.ring-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-800);
  line-height: 1;
  letter-spacing: -1px;
}

.ring-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.imc-info {
  flex: 1;
}

.category-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  transition: background var(--dur-base), color var(--dur-base);
}

.imc-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ─── IMC Scale Bar ──────────────────────────────────────── */
.scale-section {
  margin-bottom: 1.25rem;
}

.scale-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.6rem;
}

.scale-track {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: var(--radius-full);
  overflow: visible;
  gap: 2px;
}

.scale-segment {
  flex: 1;
  border-radius: var(--radius-full);
  height: 100%;
}

.seg-blue   { background: #93c5fd; }
.seg-green  { background: #86efac; flex: 1.5; }
.seg-yellow { background: #fde047; }
.seg-orange { background: #fb923c; }
.seg-red    { background: #f87171; flex: 1.5; }

.scale-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: #fff;
  border: 3px solid var(--blue-500);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: left 0.6s var(--ease-spring), border-color 0.4s var(--ease);
  z-index: 2;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.scale-labels span { flex: 1; }

/* ─── IMC Range Table ────────────────────────────────────── */
.range-table {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease);
}

.range-row:hover { background: var(--gray-50); }

.range-row.active-range {
  background: var(--gray-100);
  font-weight: 600;
}

.range-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-blue   { background: #3b82f6; }
.dot-green  { background: #22c55e; }
.dot-yellow { background: #eab308; }
.dot-orange { background: #f97316; }
.dot-red    { background: #ef4444; }

.range-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--gray-600);
}

.range-val {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

/* ─── TDEE Main Result ───────────────────────────────────── */
.tdee-main-result {
  text-align: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
  border-radius: var(--radius-lg);
  border: 1px solid #fed7aa;
  margin-bottom: 1.25rem;
}

.tdee-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--orange-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 0.4rem;
}

.tdee-value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.tdee-sublabel {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── TDEE Goal Tiles ────────────────────────────────────── */
.goals-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.goal-tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.goal-tile:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.goal-lose    { background: #fff5f5; border-color: #fecaca; }
.goal-maintain{ background: #eff6ff; border-color: #bfdbfe; }
.goal-gain    { background: #f0fdf4; border-color: #bbf7d0; }

.goal-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.goal-lose     .goal-tile-icon { background: var(--grad-lose); }
.goal-maintain .goal-tile-icon { background: var(--grad-maintain); }
.goal-gain     .goal-tile-icon { background: var(--grad-gain); }

.goal-tile-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.goal-tile-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.goal-tile-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.goal-tile-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.goal-tile-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.goal-lose     .goal-tile-badge { background: #fee2e2; color: #dc2626; }
.goal-maintain .goal-tile-badge { background: #dbeafe; color: #2563eb; }
.goal-gain     .goal-tile-badge { background: #dcfce7; color: #16a34a; }

/* ─── Disclaimer / Notes ─────────────────────────────────── */
.result-disclaimer {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.55;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100);
}

/* ─── Error States ───────────────────────────────────────── */
.input-error {
  border-color: var(--red-400) !important;
  box-shadow: 0 0 0 3px rgba(248,113,113,0.15) !important;
  background: #fff5f5 !important;
}

.error-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: #dc2626;
  animation: shake 0.4s var(--ease);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 1.5rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.footer-disclaimer {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--gray-400);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 2rem;
    gap: 1.25rem;
  }
}

@media (max-width: 600px) {
  .navbar-inner { padding: 0 1rem; }
  .nav-badge    { display: none; }

  .hero { padding: 2.5rem 1rem 2rem; }
  .hero-title { font-size: 1.75rem; }

  .panel { padding: 1.5rem 1.25rem; }

  .input-row { grid-template-columns: 1fr; }

  .result-top { flex-direction: column; text-align: center; }
  .imc-info   { text-align: center; }

  .tdee-value { font-size: 2rem; }

  .footer-inner { flex-direction: column; text-align: center; }
}

/* ─── Number input: hide spinners ────────────────────────── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }
