/* ── Layout ── */
.nav-item { color: #64748b; }
.nav-item:hover { background: #f8fafc; color: #0f172a; }
.nav-item.active { background: #fff1f2; color: #e11d48; font-weight: 600; }
.nav-item.active svg { stroke: #e11d48; }

/* ── Inputs ── */
.input-field {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 8px 12px; font-size: 14px; outline: none; background: white;
  color: #0f172a; transition: border-color 0.15s, box-shadow 0.15s;
}
.input-field:focus { border-color: #fca5a5; box-shadow: 0 0 0 3px rgba(252,165,165,0.2); }
.label { display: block; font-size: 13px; font-weight: 500; color: #475569; margin-bottom: 5px; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

/* ── Icon button ── */
.icon-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: #94a3b8; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: #f1f5f9; color: #475569; }

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed #e2e8f0; border-radius: 14px; padding: 32px 24px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #fca5a5; background: #fff5f5;
}

/* ── Cards ── */
.card {
  background: white; border-radius: 16px; border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-hover { transition: box-shadow 0.2s, transform 0.2s; cursor: pointer; }
.card-hover:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); transform: translateY(-1px); }

/* ── Status badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-normal   { background: #dcfce7; color: #15803d; }
.badge-high     { background: #fee2e2; color: #b91c1c; }
.badge-low      { background: #dbeafe; color: #1d4ed8; }
.badge-critical { background: #fef3c7; color: #b45309; }
.badge-unknown  { background: #f1f5f9; color: #64748b; }

/* ── Severity dot ── */
.dot-low      { width:8px; height:8px; border-radius:50%; background:#fbbf24; display:inline-block; }
.dot-moderate { width:8px; height:8px; border-radius:50%; background:#f97316; display:inline-block; }
.dot-high     { width:8px; height:8px; border-radius:50%; background:#ef4444; display:inline-block; }
.dot-critical { width:8px; height:8px; border-radius:50%; background:#7c2d12; display:inline-block; }

/* ── Health score ring ── */
.score-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-text {
  position: absolute; text-align: center;
}

/* ── Spinner ── */
.loader {
  width: 40px; height: 40px; border: 3px solid #fee2e2;
  border-top-color: #ef4444; border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton loaders ── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-circle { border-radius: 50%; }
.skeleton-text   { height: 12px; margin: 6px 0; }
.skeleton-card {
  display: flex; align-items: center; gap: 20px;
  background: #fff; border: 1px solid #f1f5f9; border-radius: 14px;
  padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

/* ── Progress bar ── */
.progress-bar { height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.fill-green  { background: #22c55e; }
.fill-red    { background: #ef4444; }
.fill-blue   { background: #3b82f6; }
.fill-amber  { background: #f59e0b; }

/* ── Chart container ── */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap-lg { position: relative; height: 300px; }

/* ── Supplement pill ── */
.sup-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: white; border: 1px solid #f1f5f9;
  border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s;
}
.sup-pill:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.07); }

/* ── Supplement two-column layout ── */
.sup-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.sup-sidebar {
  width: 264px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}
.sup-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: 12px 12px 0 0;
  border-bottom: none;
}
.sup-sidebar-list {
  background: white;
  border: 1px solid #f1f5f9;
  border-top: 1px solid #f8fafc;
  border-radius: 0 0 12px 12px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}
.sup-sidebar-card {
  padding: 12px 14px;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.12s;
}
.sup-sidebar-card:last-child { border-bottom: none; }
.sup-sidebar-card:hover { background: #fafafa; }

.sup-right { flex: 1; min-width: 0; }

.sup-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #94a3b8;
  line-height: 1.3;
  transition: all 0.15s;
}
.sup-tab:hover { color: #475569; }
.sup-tab-active {
  background: white;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.09);
}

/* Amazon CTA button */
.amazon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #FF9900;
  color: #1a1a1a;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}
.amazon-btn:hover { background: #e88a00; }

/* Mobile: stack */
@media (max-width: 768px) {
  .sup-layout { flex-direction: column; }
  .sup-sidebar { width: 100%; position: static; }
  .sup-sidebar-list { max-height: 50vh; }
}

/* ── Action urgency badges ── */
.urgency-now   { background:#fee2e2; color:#b91c1c; }
.urgency-week  { background:#fef3c7; color:#92400e; }
.urgency-month { background:#f0fdf4; color:#166534; }

/* ── Risk level ── */
.risk-low      { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
.risk-moderate { background:#fffbeb; border-color:#fde68a; color:#92400e; }
.risk-high     { background:#fef2f2; border-color:#fecaca; color:#b91c1c; }

/* ── Section titles ── */
.section-title { font-size: 18px; font-weight: 700; color: #0f172a; }
.section-sub   { font-size: 13px; color: #94a3b8; margin-top: 2px; }

/* ── Tabs ── */
.tab-bar { display: flex; gap: 4px; background: #f8fafc; border-radius: 12px; padding: 4px; }
.tab-btn { flex: 1; padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: #64748b; transition: all 0.15s; white-space: nowrap; }
.tab-btn.active { background: white; color: #0f172a; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab-btn:hover:not(.active) { color: #0f172a; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── AI insight panel ── */
.insight-section { border-left: 3px solid #fecaca; padding-left: 14px; }
.insight-section.green { border-color: #bbf7d0; }
.insight-section.amber { border-color: #fde68a; }
.insight-section.blue  { border-color: #bfdbfe; }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px; text-align: center; }
.empty-icon { width: 72px; height: 72px; border-radius: 50%; background: #fff1f2; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }

/* ── Tooltip-like footnote ── */
.footnote { font-size: 11px; color: #94a3b8; font-style: italic; }

/* ── Dual-range bar ── */
.range-bar-wrap {
  position: relative; height: 8px; background: #f1f5f9;
  border-radius: 999px; overflow: visible;
}
.range-bar-optimal {
  position: absolute; top: 0; height: 100%;
  background: rgba(34,197,94,0.18); border: 1px solid rgba(34,197,94,0.45);
  border-radius: 999px; pointer-events: none;
}
.range-bar-tick {
  position: absolute; top: -4px; width: 3px; height: 16px;
  border-radius: 2px; transform: translateX(-50%); pointer-events: none;
}
.tick-optimal  { background: #16a34a; }
.tick-subopt   { background: #f59e0b; }
.tick-low      { background: #3b82f6; }
.tick-high     { background: #ef4444; }

/* ── Optimal status badges ── */
.badge-optimal    { background: #dcfce7; color: #15803d; }
.badge-suboptimal { background: #fef3c7; color: #92400e; }

/* ── Badge tooltips ── */
.tooltip-badge {
  cursor: help;
}

/* JS-driven global tooltip (appended to body, position:fixed — never clipped) */
#global-tooltip {
  position: fixed;
  z-index: 9999;
  background: #1e293b;
  color: #f8fafc;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: normal;
  width: 220px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s;
}
#global-tooltip.visible { opacity: 1; }
#global-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

/* ── Timeline pills ── */
.timeline-wrap { overflow-x: auto; padding-bottom: 4px; }
.timeline-wrap::-webkit-scrollbar { height: 3px; }
.timeline-inner { display: flex; gap: 10px; min-width: max-content; }
.timeline-pill {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px; border-radius: 14px; border: 2px solid #f1f5f9;
  background: white; cursor: pointer; transition: all 0.15s;
  min-width: 72px;
}
.timeline-pill:hover { border-color: #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.timeline-pill.active { border-color: #fecaca; background: #fff1f2; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; }
.timeline-connector { width: 20px; height: 2px; background: #e2e8f0; align-self: center; flex-shrink: 0; }

/* ── Pattern cards ── */
.pattern-card { border-left: 4px solid #e2e8f0; }
.pattern-card.sev-leve     { border-left-color: #93c5fd; }
.pattern-card.sev-moderado { border-left-color: #fbbf24; }
.pattern-card.sev-severo   { border-left-color: #f87171; }

/* ── Condition chips ── */
.cond-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; background: #ede9fe; color: #5b21b6;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.cond-chip button { font-size: 14px; line-height: 1; color: #7c3aed; opacity: 0.6; }
.cond-chip button:hover { opacity: 1; }

/* ── Insight sub-tabs ── */
.insight-subtab {
  padding: 6px 16px; font-size: 13px; font-weight: 500; color: #64748b;
  border-bottom: 2px solid transparent; transition: all 0.15s; white-space: nowrap;
}
.insight-subtab:hover { color: #0f172a; }
.insight-subtab.active { color: #0f172a; font-weight: 600; border-bottom-color: #0f172a; }

/* ── Progression cards ── */
.prog-improved { background: #f0fdf4; border: 1px solid #bbf7d0; }
.prog-worsened { background: #fef2f2; border: 1px solid #fecaca; }
.prog-neutral   { background: #f8fafc; border: 1px solid #e2e8f0; }

/* ── Condition score ring ── */
.cond-score-bar { height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }

/* ── Analysis pills in dashboard ── */
.analysis-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.analysis-pill:hover { border-color: #94a3b8; color: #1e293b; }
.analysis-pill.active { border-color: #ef4444; background: #fff1f2; color: #dc2626; font-weight: 600; }
.analysis-pill .score-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Evolution button ── */
.evolution-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1e293b;
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  border: none;
}
.evolution-btn:hover { background: #334155; }

/* ── Login screen ── */
#login-screen { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── User avatar in sidebar ── */
#user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
