/* ========================================
   振华经方 · 统一样式表
   桂林古本《伤寒杂病论》专属AI问诊系统
   ======================================== */

/* CSS变量 - 中医主题配色 */
:root {
  --bg-primary: #1a1410;
  --bg-secondary: #2a1f14;
  --bg-card: rgba(42, 31, 20, 0.8);
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --gold-primary: #f0d060;
  --gold-secondary: #c9a84c;
  --bronze: #8b6914;
  --text-primary: #d4c5a9;
  --text-secondary: #b8a080;
  --text-muted: #6b5a3a;
  --border: #8b6914;
  --shadow: rgba(139, 105, 20, 0.4);
  --shadow-hover: rgba(240, 208, 96, 0.5);
  --transition: 0.3s ease;
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 字体族 - 中医古籍韵味 */
body {
  font-family: "STSong", "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
}

/* 导航栏 */
.nav {
  background: var(--bg-overlay);
  padding: 1rem 2rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav a {
  color: var(--gold-secondary);
  text-decoration: none;
  font-size: 1.1rem;
  transition: var(--transition);
  position: relative;
}

.nav a:hover,
.nav a.active {
  color: var(--gold-primary);
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold-primary);
  transition: var(--transition);
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
}

/* Hero区域 */
.hero {
  text-align: center;
  padding: 5rem 2rem 3rem;
  background: linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
}

.hero h1 {
  font-size: 3rem;
  color: var(--gold-primary);
  margin-bottom: 1rem;
  text-shadow: 0 2px 10px rgba(240, 208, 96, 0.3);
  font-weight: normal;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2rem;
  line-height: 1.8;
}

.hero .btn {
  display: inline-block;
  padding: 1rem 3rem;
  background: linear-gradient(135deg, var(--bronze), var(--gold-secondary));
  color: var(--bg-primary);
  font-size: 1.3rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--shadow);
}

.hero .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--shadow-hover);
}

/* 通用区块 */
.section {
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section h2 {
  color: var(--gold-primary);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  position: relative;
  font-weight: normal;
}

.section h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: var(--bronze);
  margin: 1rem auto;
}

/* 卡片网格 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--gold-primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}

.card h3 {
  color: var(--gold-primary);
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
  font-weight: normal;
}

.card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.95rem;
}

.card a {
  color: var(--gold-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.card a:hover {
  color: var(--gold-primary);
}

/* 壁垒样式 */
.walls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.wall {
  background: rgba(42, 31, 20, 0.6);
  border-left: 3px solid var(--bronze);
  padding: 1rem;
  font-size: 0.9rem;
  transition: var(--transition);
}

.wall:hover {
  border-left-color: var(--gold-primary);
  background: rgba(42, 31, 20, 0.8);
}

.wall strong {
  color: var(--gold-primary);
  display: block;
  margin-bottom: 0.5rem;
}

/* 页脚 */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--bronze);
  font-size: 0.85rem;
  border-top: 1px solid rgba(139, 105, 20, 0.3);
  margin-top: 3rem;
}

.footer p {
  margin: 0.5rem 0;
}

/* 链接通用 */
a {
  color: var(--gold-secondary);
  transition: var(--transition);
}

a:hover {
  color: var(--gold-primary);
}

/* 按钮通用 */
button,
.btn {
  background: linear-gradient(135deg, var(--bronze), var(--gold-secondary));
  color: var(--bg-primary);
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

/* 输入框 */
input[type="text"],
textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.8rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  transition: var(--transition);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px rgba(240, 208, 96, 0.2);
}

/* 图片 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 懒加载占位 */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded,
img:not([loading="lazy"]) {
  opacity: 1;
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .hero p {
    font-size: 1.1rem;
  }
  
  .section {
    padding: 2.5rem 1.5rem;
  }
  
  .cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* 汉堡菜单按钮 - 默认隐藏 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 101;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gold-primary);
  margin: 5px 0;
  transition: var(--transition);
  border-radius: 2px;
}

/* 汉堡菜单激活状态 */
.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* 手机 (< 768px) */
@media (max-width: 768px) {
  /* 导航栏 - 汉堡菜单模式 */
  .nav {
    padding: 0.8rem 1rem;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(26, 20, 16, 0.98);
    flex-direction: column;
    padding: 1rem;
    gap: 0;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links a {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(139, 105, 20, 0.2);
    text-align: center;
  }
  
  .nav-links a:last-child {
    border-bottom: none;
  }
  
  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(240, 208, 96, 0.1);
  }
  
  .nav-links a::after {
    display: none;
  }
  
  /* Hero - 移动端缩小 */
  .hero {
    padding: 3rem 1.5rem 2rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .hero .btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
  }
  
  /* 区块 - 移动端紧凑 */
  .section {
    padding: 2rem 1rem;
  }
  
  .section h2 {
    font-size: 1.6rem;
  }
  
  /* 卡片 - 移动端单列 */
  .cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .card {
    padding: 1.2rem;
  }
  
  /* 壁垒 - 移动端双列 */
  .walls {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  
  .wall {
    padding: 0.8rem;
    font-size: 0.85rem;
  }
  
  /* 问诊页移动端修复 */
  .agent-input-row {
    flex-direction: column;
  }
  
  .agent-input {
    width: 100%;
  }
  
  .agent-btn {
    width: 100%;
  }
  
  .agent-pipeline {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 页脚 */
  .footer {
    padding: 2rem 1rem;
    font-size: 0.8rem;
  }
}

/* 小手机 (< 480px) */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }
  
  .hero p {
    font-size: 0.9rem;
  }
  
  .walls {
    grid-template-columns: 1fr;
  }
  
  .agent-pipeline {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   动画效果
   ======================================== */

/* 淡入动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* 卡片悬停增强 */
.card {
  animation: fadeIn 0.6s ease-out;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* ========================================
   标签/芯片（候诊登记 + 知识筛选）
   ======================================== */
.tag-row {
  display: flex; flex-wrap: wrap; gap: 9px;
}
.tag {
  padding: 9px 16px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg-secondary); color: var(--text-muted);
  cursor: pointer; user-select: none;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.04em;
  position: relative;
}
.tag:hover, .tag:active { background: rgba(240,208,96,.1); }
.tag.active, .tag.selected {
  background: linear-gradient(135deg, var(--bronze), var(--gold-secondary));
  color: var(--bg-primary); border-color: var(--gold-primary); font-weight: 500;
}

/* ========================================
   排队状态栏
   ======================================== */
.queue-bar {
  display: flex; gap: 2rem; justify-content: center;
  align-items: center; font-size: .8rem; color: var(--text-muted);
}
.queue-bar .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4a7c3f; margin-right: .3rem; display: inline-block;
}
.queue-bar .dot.busy {
  background: var(--gold-secondary); animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .4; } }

/* ========================================
   分隔线
   ======================================== */
.section-divider {
  text-align: center; padding: 2rem 0;
  color: var(--bronze); font-size: .85rem; letter-spacing: .1em;
}
.section-divider::before, .section-divider::after {
  content: ' ── '; color: #3d2e14;
}

/* ========================================
   处方卡片
   ======================================== */
.prescription {
  background: rgba(201,169,110,0.08); border: 1px solid var(--gold-secondary);
  border-radius: 6px; padding: 12px; margin-top: 6px;
  font-size: 14px; line-height: 1.7;
}
.prescription strong { color: var(--gold-secondary); }

/* 焦点可见性（无障碍） */
:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

/* 打印样式 */
@media print {
  .nav,
  .footer {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
}
