/* ============================================
   aidoctor.net.cn — 安医 · AI健康科普工具站
   设计调性: 清透白底 + 医蓝/薄荷绿/暖橙点缀
   字体: 非衬线黑体 (system stack)
   交付标准: 跨国企业级 · 医疗信任感
   ============================================ */

/* ── CSS Variables ── */
:root {
  --primary: #2563EB;       /* 医蓝 */
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --accent: #10B981;        /* 薄荷绿 — 在线/健康信号 */
  --accent-warm: #F59E0B;   /* 暖橙 — 急症/警示 */
  --bg: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-card: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --max-width: 720px;
}

/* ── Reset ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth;-webkit-font-smoothing:antialiased}
body{font-family:var(--font-stack);color:var(--text);background:var(--bg);line-height:1.7}
a{color:var(--primary);text-decoration:none;transition:color 0.15s}
a:hover{color:var(--primary-dark)}
img{max-width:100%;height:auto;display:block}

/* ── Disclaimer Bar ── */
.disclaimer-bar {
  background: var(--primary-dark);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.8rem;
  letter-spacing: 0.3px;
}
.disclaimer-bar a {
  color: #93C5FD;
  text-decoration: underline;
}
.disclaimer-bar a:hover { color: #BFDBFE; }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--primary); }
.lang-switch {
  background: var(--bg-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: var(--primary) !important;
}

/* ── Hero (Chat-first Home) ── */
.home-hero {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  text-align: center;
}
.home-hero .eyebrow {
  display: inline-block;
  background: #DBEAFE;
  color: var(--primary-dark);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.home-hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: -0.5px;
}
.home-hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Chat Input (home) ── */
.chat-container {
  max-width: 640px;
  margin: 0 auto;
}
.chat-input-wrap {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg);
}
.chat-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.chat-input-wrap textarea {
  width: 100%;
  border: none;
  padding: 16px 18px;
  font-size: 1rem;
  font-family: var(--font-stack);
  resize: none;
  outline: none;
  line-height: 1.6;
  min-height: 56px;
  max-height: 160px;
}
.chat-input-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 12px;
  background: var(--bg);
}
.chat-examples {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-examples .chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chat-examples .chip:hover {
  background: #DBEAFE;
  border-color: var(--primary-light);
  color: var(--primary);
}
.chat-send {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font-stack);
}
.chat-send:hover { background: var(--primary-dark); }
.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Chat Response Area ── */
.chat-response {
  margin-top: 16px;
  display: none;
}
.chat-response.active { display: block; }
.chat-response-message {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-disclaimer {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: #92400E;
  text-align: left;
}

/* ── Sections (below hero) ── */
.home-sections {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}
.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
  cursor: pointer;
}
.guide-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}
.guide-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}
.guide-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.guide-card .card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
}
.guide-card .card-cat {
  display: inline-block;
  background: #DBEAFE;
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ── Guide Page ── */
.guide-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.guide-page h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}
.guide-page .guide-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.guide-page h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 32px;
  margin-bottom: 12px;
}
.guide-page h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 8px;
}
.guide-page p {
  margin-bottom: 14px;
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text);
}
.guide-page .emergency-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-left: 4px solid #EF4444;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
}
.guide-page .emergency-box strong { color: #DC2626; }
.guide-page .guide-source {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: -4px;
}
.guide-cta {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 32px;
  text-align: center;
}
.guide-cta p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.guide-cta button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-stack);
}

/* ── Chat Widget (bubble) ── */
.chat-widget-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}
.chat-widget-trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.2s;
  position: relative;
}
.chat-widget-trigger:hover {
  transform: scale(1.05);
  background: var(--primary-dark);
}
.online-dot {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.chat-widget-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100dvh - 120px);
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
}
.chat-widget-panel.active { display: flex; }
.chat-widget-header {
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-widget-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.8;
}
.chat-widget-close:hover { opacity: 1; }
.chat-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-widget-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-widget-footer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-stack);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 100px;
  line-height: 1.5;
}
.chat-widget-footer textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.msg-bot {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  align-self: flex-start;
  max-width: 85%;
  white-space: pre-wrap;
}
.msg-user {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  align-self: flex-end;
  max-width: 85%;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.8;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.footer-col h4 {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 3px 0;
}
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  max-width: 1100px;
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Guides Index ── */
.guides-index {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.guides-index h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.guides-index .index-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}
.guides-categories {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.guides-categories .cat-chip {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.guides-categories .cat-chip.active,
.guides-categories .cat-chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Disclaimer Page ── */
.disclaimer-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.disclaimer-page h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
}
.disclaimer-page h2 {
  font-size: 1.2rem;
  margin-top: 28px;
  margin-bottom: 10px;
}
.disclaimer-page p {
  margin-bottom: 14px;
  line-height: 1.8;
}

/* ── 404 ── */
.page-404 {
  text-align: center;
  padding: 80px 24px;
}
.page-404 h1 { font-size: 4rem; color: var(--text-muted); }
.page-404 p { color: var(--text-secondary); margin: 16px 0 24px; }
.page-404 a { font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .home-hero h1 { font-size: 1.8rem; }
  .home-hero { padding: 40px 20px 60px; }
  .guides-grid { grid-template-columns: 1fr; }
  .chat-widget-panel { width: calc(100vw - 32px); right: 16px; bottom: 88px; }
  .navbar { padding: 12px 16px; }
  .nav-links { gap: 12px; }
}
