/* ===== 全局基础样式 ===== */
:root {
  --primary: #8B4513;
  --primary-light: #A0522D;
  --primary-dark: #6B3410;
  --gold: #D4A853;
  --gold-light: #F0D88A;
  --bg-cream: #FFF8F0;
  --bg-card: #FFFFFF;
  --text-dark: #2C1810;
  --text-medium: #5C4033;
  --text-light: #8B7355;
  --border: #E8D5B7;
  --shadow: 0 2px 12px rgba(139, 69, 19, 0.08);
  --shadow-hover: 0 4px 20px rgba(139, 69, 19, 0.15);
  --radius: 8px;
  --danger: #c0392b;
  --success: #27ae60;
  --info: #2980b9;
  --yang: #c0392b;
  --yin: #2980b9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
  padding-top: 48px;
  padding-bottom: 72px;
}

/* ===== 容器 ===== */
.main-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  min-height: calc(100vh - 48px - 72px - 60px);
}

.page-header {
  text-align: center;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-light);
  font-size: 13px;
}

/* ===== 顶部标题栏 ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 1000;
  border-bottom: 2px solid var(--gold);
}

.app-header .header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 4px;
}

.app-header .header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

/* ===== 底部导航栏 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(139,69,19,0.06);
  padding: 0 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  min-width: 48px;
  border: none;
  background: none;
  color: var(--text-light);
}

.nav-item:hover {
  background: rgba(139,69,19,0.05);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-label {
  font-weight: 600;
  color: var(--primary);
}

.nav-icon {
  width: 22px;
  height: 22px;
}

.nav-label {
  font-size: 10px;
  color: var(--text-light);
  transition: color 0.2s;
}

/* 桌面端导航优化 */
@media (min-width: 769px) {
  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px 12px 0 0;
  }
  
  .nav-item {
    padding: 6px 14px;
  }
  
  .nav-label {
    font-size: 11px;
  }
}

/* ===== 首页 ===== */
.home-container {
  text-align: center;
  padding: 40px 16px;
}

.home-hero {
  margin-bottom: 40px;
}

.home-hero .site-title {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 2px 2px 4px rgba(139,69,19,0.1);
  margin-bottom: 8px;
  letter-spacing: 8px;
}

.home-hero .site-subtitle {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  box-shadow: var(--shadow);
}

.home-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--gold);
}

.home-card .icon-wrapper {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary-dark);
}

.home-card h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 6px;
}

.home-card p {
  font-size: 13px;
  color: var(--text-light);
}

/* ===== 卡片容器 ===== */
.form-card,
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.form-card .el-form-item__label {
  color: var(--text-medium);
  font-weight: 500;
}

/* ===== 四柱表格 ===== */
.bazi-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.bazi-table th,
.bazi-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: center;
  width: 25%;
}

.bazi-table th {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-weight: 500;
  font-size: 15px;
}

.bazi-table td {
  background: #fff;
}

.bazi-table .gan {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.bazi-table .zhi {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-light);
}

.bazi-table .sub-row {
  color: var(--text-light);
  font-size: 13px;
}

/* ===== 六爻卦象 ===== */
.yao-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  padding: 16px;
  background: #faf5ee;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.yao-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.yao-line .labels {
  display: flex;
  gap: 10px;
  min-width: 120px;
  font-size: 12px;
  color: var(--text-light);
  justify-content: flex-end;
}

.yao-line .labels .shi {
  color: var(--danger);
  font-weight: 700;
}

.yao-line .labels .ying {
  color: var(--info);
  font-weight: 700;
}

.yao-line .yao-graph {
  min-width: 120px;
  text-align: center;
}

.yao-line .yao-graph .yang-line {
  display: block;
  width: 100px;
  height: 6px;
  background: var(--yang);
  margin: 2px auto;
  border-radius: 3px;
}

.yao-line .yao-graph .yin-line {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.yao-line .yao-graph .yin-line span {
  width: 36px;
  height: 6px;
  background: var(--yin);
  border-radius: 3px;
}

.yao-line .yao-graph .old-yang {
  width: 100px;
  height: 6px;
  background: var(--gold);
  margin: 2px auto;
  border-radius: 3px;
  position: relative;
}

.yao-line .yao-graph .old-yang::after {
  content: '○';
  position: absolute;
  right: -22px;
  top: -8px;
  font-size: 16px;
  color: var(--gold);
}

.yao-line .yao-graph .old-yin {
  display: flex;
  justify-content: center;
  gap: 16px;
  position: relative;
}

.yao-line .yao-graph .old-yin span {
  width: 36px;
  height: 6px;
  background: var(--gold);
  border-radius: 3px;
}

.yao-line .yao-graph .old-yin::after {
  content: '×';
  position: absolute;
  right: -22px;
  top: -8px;
  font-size: 16px;
  color: var(--gold);
}

.yao-line .yao-text {
  font-size: 13px;
  color: var(--text-medium);
  min-width: 80px;
  text-align: left;
}

.hexagram-container {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.hexagram-box {
  text-align: center;
}

.hexagram-box h4 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 16px;
}

/* ===== 梅花易数 ===== */
.gua-container {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.gua-card {
  background: #faf5ee;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  min-width: 140px;
}

.gua-card h4 {
  color: var(--primary);
  margin-bottom: 8px;
}

.gua-card .gua-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
}

.gua-card .gua-lines {
  margin: 8px 0;
}

.gua-card .gua-lines .gua-line {
  margin: 2px auto;
}

/* ===== 五行雷达图 ===== */
#wuXingChart {
  width: 100%;
  height: 320px;
  margin: 16px 0;
}

/* ===== 标签样式 ===== */
.wuxing-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #fff;
  margin: 0 2px;
}

.wuxing-tag.wood, .wuxing-tag.\6728 { background: #27ae60; }
.wuxing-tag.fire, .wuxing-tag.\706B { background: #e74c3c; }
.wuxing-tag.earth, .wuxing-tag.\571F { background: #D4A853; }
.wuxing-tag.metal, .wuxing-tag.\91D1 { background: #7f8c8d; }
.wuxing-tag.water, .wuxing-tag.\6C34 { background: #2980b9; }

/* ===== 大运表格 ===== */
.dayun-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.dayun-table th,
.dayun-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: center;
}

.dayun-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

/* ===== 分数条 ===== */
.score-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.score-bar-label {
  min-width: 50px;
  font-size: 13px;
  font-weight: 500;
}

.score-bar-track {
  flex: 1;
  height: 16px;
  background: #f0e0c8;
  border-radius: 8px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s ease;
}

.score-bar-value {
  min-width: 30px;
  font-size: 13px;
  text-align: right;
}

/* ===== 知识库 ===== */
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.article-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-hover);
}

.article-card h3 {
  color: var(--primary);
  font-size: 17px;
  margin-bottom: 8px;
}

.article-card .article-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.article-card p {
  font-size: 14px;
  color: var(--text-medium);
  line-height: 1.6;
}

.article-content {
  line-height: 1.8;
  font-size: 15px;
}

.article-content h2 {
  color: var(--primary);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.article-content h3 {
  color: var(--primary-light);
  margin: 20px 0 10px;
}

.article-content p {
  margin: 10px 0;
  text-indent: 2em;
}

.article-content ul, .article-content ol {
  margin: 10px 0;
  padding-left: 2em;
}

.article-content li {
  margin: 4px 0;
}

/* ===== 底部 ===== */
.site-footer {
  text-align: center;
  padding: 16px;
  background: var(--primary-dark);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  line-height: 1.6;
  padding-bottom: 72px;
}

.site-footer p {
  margin: 2px 0;
}

/* ===== AI 解读区域 ===== */
.ai-interpretation {
  background: linear-gradient(135deg, #f0f5ff, #e8f0fe);
  border: 1px solid #c8d8f0;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.ai-interpretation .ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-interpretation .ai-header .ai-badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.ai-interpretation .ai-header .ai-label {
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
}

.ai-interpretation .ai-content {
  font-size: 14px;
  color: var(--text-medium);
  line-height: 1.9;
  white-space: pre-wrap;
}

.ai-interpretation .ai-content p {
  margin: 8px 0;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text-light);
  font-size: 14px;
}

.ai-loading .ai-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.question-input {
  margin-top: 12px;
}

.question-input .el-input__inner {
  font-size: 14px;
}

/* 流式输出光标 */
.stream-cursor {
  animation: blink 0.8s step-end infinite;
  color: var(--primary);
  font-weight: bold;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .main-container {
    padding: 16px 12px;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-hero .site-title {
    font-size: 32px;
    letter-spacing: 4px;
  }

  .bazi-table {
    font-size: 12px;
  }

  .bazi-table th,
  .bazi-table td {
    padding: 6px 4px;
  }

  .yao-line .labels {
    min-width: 60px;
    font-size: 11px;
  }

  .hexagram-container {
    gap: 16px;
  }

  .gua-container {
    gap: 12px;
  }
}

/* ===== Element Plus 覆盖 ===== */
.el-form-item {
  margin-bottom: 18px;
}

.el-button--primary {
  --el-button-bg-color: var(--primary);
  --el-button-border-color: var(--primary);
  --el-button-hover-bg-color: var(--primary-light);
  --el-button-hover-border-color: var(--primary-light);
}

.el-tag--danger { --el-tag-bg-color: #fde8e8; }
.el-tag--success { --el-tag-bg-color: #e8f8ed; }
.el-tag--warning { --el-tag-bg-color: #fdf6e8; }
.el-tag--info { --el-tag-bg-color: #e8f0fa; }

/* ===== 合规声明 Banner ===== */
.compliance-banner {
  background: linear-gradient(135deg, #fff8f0, #fef6e4);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* ===== 按钮间距 ===== */
.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ===== 结果高亮 ===== */
.result-highlight {
  background: linear-gradient(135deg, #fff8f0, #fef6e4);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  text-align: center;
}

.result-highlight .big-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-dark);
}

.result-highlight .sub-text {
  font-size: 14px;
  color: var(--text-medium);
  margin-top: 4px;
}

/* ===== 摇卦动画 ===== */
.coin-container {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.coin-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: linear-gradient(145deg, #f0d88a, #d4a853);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.coin-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

.coin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.coin-btn.flipped {
  animation: flip 0.5s ease;
}

@keyframes flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}

.coin-result {
  text-align: center;
  font-size: 18px;
  margin: 8px 0;
}

/* ===== 步进器 ===== */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.step-dot.active {
  background: var(--gold);
  transform: scale(1.2);
}

.step-dot.done {
  background: var(--success);
}

/* ===== 五格表格 ===== */
.wuge-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.wuge-table th,
.wuge-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: center;
  font-size: 14px;
}

.wuge-table th {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.wuge-table .good {
  color: var(--success);
  font-weight: 600;
}

.wuge-table .bad {
  color: var(--danger);
  font-weight: 600;
}

.wuge-table .neutral {
  color: var(--gold);
  font-weight: 600;
}
