/* ========== 统一设计变量 ========== */
:root {
  --primary: #1b6ec2;
  --primary-hover: #1861ac;
  --primary-light: #e8f1fa;
  --text: #2c3e50;
  --text-muted: #555;
  --border: #dee2e6;
  --border-light: #eaeaea;
  --bg-page: #f5f7fa;
  --bg-card: #fff;
  --bg-th: #f4f6f9;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  --font-sans: "Segoe UI", "Microsoft JhengHei", "PingFang SC", sans-serif;
}

/* ========== 基础与版式 ========== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg-page);
  line-height: 1.6;
}

/* ========== 顶部导航（线上观感优化） ========== */
.app-navbar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-bottom: 1px solid #e6ecf3;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  margin-bottom: 1rem;
}

.app-navbar-inner {
  min-height: 58px;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.app-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #183b62 !important;
  letter-spacing: 0.2px;
}

.app-nav-list {
  align-items: center;
  gap: 0.3rem;
}

.app-nav-link {
  color: #2f4156 !important;
  font-size: 0.96rem;
  font-weight: 600;
  padding: 0.42rem 0.78rem !important;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-nav-link:hover {
  background: #eaf2fc;
  color: #0d4f8b !important;
}

.app-main-container {
  max-width: 1200px;
}

@media (max-width: 576px) {
  .app-brand {
    font-size: 1.03rem;
  }

  .app-nav-link {
    margin-top: 2px;
    margin-bottom: 2px;
  }
}

/* 统一页面标题 */
main h1 {
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 1rem;
  font-weight: 600;
}

main h2 {
  font-size: 1.35rem;
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
  font-weight: 600;
}

/* 内容卡片容器 */
.content-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

/* ========== 问诊/详情表格 ========== */
.diagnosis-table,
.pulse-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.diagnosis-table th,
.diagnosis-table td,
.pulse-table th,
.pulse-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
}

.diagnosis-table th,
.pulse-table th {
  background-color: var(--bg-th);
  font-weight: 600;
  color: var(--text);
}

.pulse-table th,
.pulse-table td {
  text-align: center;
  vertical-align: middle;
}

.pulse-table th[rowspan] {
  vertical-align: middle;
}

@media (max-width: 768px) {
  .pulse-table th,
  .pulse-table td {
    padding: 0.4rem;
    font-size: 0.9rem;
  }
  .pulse-table th[rowspan] {
    font-size: 0.9rem;
  }
}

/* ========== 链接与按钮 ========== */
a {
  color: var(--primary);
}

.history-link {
  color: var(--primary);
  text-decoration: none;
  margin-right: 0.5rem;
}

.history-link:hover {
  text-decoration: underline;
}

.wuyun-btn {
  background: var(--primary);
  color: white;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
  font-weight: 500;
}

.wuyun-btn:hover {
  background: var(--primary-hover);
}

.btn-primary {
  color: #fff;
  background-color: var(--primary);
  border-color: var(--primary-hover);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.refresh-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

.refresh-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.button-container {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.75rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ========== 舌象图片 ========== */
.tongue-image-container {
  display: inline-block;
  text-align: center;
  margin: 0.5rem 1rem 0.5rem 0;
}

.tongue-image-container img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tongue-image-container p {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ========== 梅花/卦象 ========== */
.gua-image {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px 0;
  font-family: var(--font-sans);
  margin: 0.5rem 0;
}

.yao-line {
  width: 80px;
  height: 6px;
  margin: 4px 0;
  border-radius: 3px;
}

.yang-yao {
  background-color: #000;
}

.yin-yao {
  background-image: linear-gradient(to right, #000 0, #000 32%, transparent 32%, transparent 68%, #000 68%, #000 100%);
}

.changing-yao {
  box-shadow: 0 0 4px 1px rgba(255, 152, 0, 0.9);
  outline: 2px solid #ff9800;
}

.gua-section {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.gua-section:hover {
  box-shadow: var(--shadow-hover);
}

.gua-section h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.gua-section p,
.gua-section div {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.gua-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (min-width: 992px) {
  .gua-row {
    flex-wrap: nowrap;
  }

  .gua-section {
    flex: 1 0 0;
    min-width: 0;
  }
}

.gua-box {
  margin: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.gua-img {
  margin: 0.5rem 0;
}

.yao {
  margin: 2px 0;
}

.highlight {
  background: #fff8e6;
}

.tiyong {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.clickable-gua {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  margin: 0 2px;
  display: inline-block;
}

.clickable-gua:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* 卦象详情模态框 */
.gua-detail-modal {
  font-family: var(--font-sans);
  color: var(--text);
}

.gua-detail-modal th {
  text-align: left;
  padding: 0.5rem;
  background: var(--bg-th);
  width: 100px;
}

.gua-detail-modal td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.gua-detail-modal h3 {
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
  margin-top: 0;
}

.explanation-box {
  background-color: var(--bg-th);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.note-text {
  font-size: 0.9em;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

.change-yao-section,
.prognosis-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}

.gua-components {
  display: flex;
  justify-content: space-around;
  margin: 0.5rem 0;
  font-weight: 600;
}

.ti-component {
  color: #c7256e;
}

.yong-component {
  color: var(--primary);
}

/* 五运六气区块 */
.wuyun-section {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ========== 首页问诊卡（Tab + 表单） ========== */
.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  background: var(--primary);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  gap: 0.25rem;
}

.tab {
  padding: 0.6rem 1.25rem;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: var(--radius);
}

.tab:hover,
.tab.active {
  background: rgba(255, 255, 255, 0.2);
}

.tab-content {
  display: none;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.tab-content.active {
  display: block;
}

.form-card {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.form-card label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: var(--text);
}

.form-card input,
.form-card textarea,
.form-card select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  box-sizing: border-box;
  font-family: inherit;
}

.form-card textarea {
  resize: vertical;
  min-height: 80px;
}

.form-card button[type="submit"] {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.form-card button[type="submit"]:hover {
  background: var(--primary-hover);
}

.form-card button.submitting {
  background-color: #95a5a6;
  cursor: not-allowed;
}

.form-card button.submitting::after {
  content: "提交中...";
  color: white;
}

.date-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--primary-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.date-link {
  color: var(--primary);
  text-decoration: none;
}

.date-link:hover {
  text-decoration: underline;
}

/* ========== 关于我们 / 通用区块 ========== */
.box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.mb-10 {
  margin-bottom: 2rem;
}

.box section h2 {
  margin-top: 0;
}

.about-img {
  max-width: 100%;
  height: auto;
  background-color: var(--border-light);
  border-radius: var(--radius);
}

.about-wechat {
  width: 280px;
  height: 360px;
  object-fit: cover;
  margin: 0.5rem 0 0 0;
}

.about-apps {
  margin: 0.5rem 0 0 0;
}

.about-apps .about-img {
  width: 100%;
  max-width: 270px;
  height: 270px;
  object-fit: cover;
  margin-bottom: 1rem;
}

/* ========== 导航与页脚（覆盖 Bootstrap） ========== */
.navbar {
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-weight: 600;
  color: var(--text) !important;
}

.nav-link {
  font-weight: 500;
  color: var(--text) !important;
}

.nav-link:hover {
  color: var(--primary) !important;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 原有 _Layout 相关保留 */
a.navbar-brand {
  white-space: normal;
  text-align: center;
  word-break: break-all;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #fff !important;
  background-color: var(--primary);
  border-color: var(--primary-hover);
}

.border-top {
  border-top: 1px solid var(--border);
}

.border-bottom {
  border-bottom: 1px solid var(--border);
}

.box-shadow {
  box-shadow: var(--shadow);
}

button.accept-policy {
  font-size: 1rem;
  line-height: inherit;
}

/* 脉象分析模态框（zangshiDetails 等） */
.pulse-analysis-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  overflow: auto;
}

.pulse-analysis-content {
  background: var(--bg-card);
  max-width: 800px;
  margin: 40px auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
}

.pulse-analysis-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--text) 100%);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.pulse-analysis-header h3 {
  font-size: 1.35rem;
  margin: 0;
}

.close-analysis {
  color: white;
  font-size: 1.75rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.close-analysis:hover {
  transform: rotate(90deg);
}

.pulse-analysis-body {
  padding: 1.25rem;
  max-height: 70vh;
  overflow-y: auto;
}

.analysis-result {
  background: #fff8e1;
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  border-left: 4px solid #ffc107;
}

.pulse-analysis-item {
  background: var(--bg-th);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--primary);
}

.pulse-analysis-item h5 {
  color: var(--text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.pulse-analysis-item h5 i {
  margin-right: 0.5rem;
  color: var(--primary);
}

.pulse-analysis-summary {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.analyze-pulse-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
  margin: 0.5rem 0;
}

.analyze-pulse-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* 折叠/展开按钮（梅花易数等） */
.toggle-btn-reset {
  all: unset;
  cursor: pointer;
  width: 100%;
  display: block;
}

.toggle-btn-reset > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 调理建议输入框：纯文本无下拉，文字多时全部显示 */
.treatment-advice-input {
  min-height: 180px;
  resize: vertical;
  overflow-y: auto;
  width: 100%;
}
