/* HRV Knowledge Base - Shared Styles */
:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --accent: #e74c3c;
  --accent-green: #22c55e;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  padding: 0 0 80px 0;
  max-width: 100%;
  overflow-x: hidden;
}

.header {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: white;
  padding: 28px 20px 24px;
  text-align: center;
}
.header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.header .subtitle { font-size: 0.9rem; opacity: 0.85; }

.breadcrumb {
  padding: 12px 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: white;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }

.content { padding: 20px; max-width: 680px; margin: 0 auto; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--primary);
}

.card h3 {
  font-size: 1rem;
  margin: 14px 0 8px;
  color: var(--text);
}

.card p { margin-bottom: 10px; font-size: 0.93rem; }

.card ul, .card ol {
  margin: 8px 0 12px 20px;
  font-size: 0.93rem;
}
.card li { margin-bottom: 4px; }

.illustration {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 16px;
  margin: 14px 0;
  text-align: center;
  overflow-x: auto;
}
.illustration svg { max-width: 100%; height: auto; }
.illustration .caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.formula {
  background: #f1f5f9;
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  overflow-x: auto;
}

.highlight-box {
  background: var(--primary-light);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.9rem;
}
.highlight-box.green { background: #dcfce7; }
.highlight-box.amber { background: #fef3c7; }
.highlight-box.red { background: #fee2e2; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 6px;
}
.badge.time { background: #dbeafe; color: #1d4ed8; }
.badge.freq { background: #fce7f3; color: #be185d; }
.badge.nonlinear { background: #ede9fe; color: #6d28d9; }

.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.nav-card {
  display: block;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-card:active { transform: scale(0.97); }
.nav-card .nav-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 4px;
}
.nav-card .nav-desc { font-size: 0.8rem; color: var(--text-muted); }
.nav-card.full-width { grid-column: 1 / -1; }

.page-nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  flex: 1;
  display: block;
  padding: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--primary);
  text-align: center;
  font-weight: 600;
}
.page-nav a.prev::before { content: "\2190  "; }
.page-nav a.next::after { content: "  \2192"; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 12px 0;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; background: #f8fafc; }

/* Animations */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
}
.heartbeat { animation: heartbeat 1.2s ease-in-out infinite; display: inline-block; }

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}
.animate-line {
  stroke-dasharray: 1000;
  animation: drawLine 2s ease-in-out forwards;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.blink { animation: blink 1.5s ease-in-out infinite; }

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
