/* ==========================================================================
   知经 · 高频计算公式宝典样式 (Formula Atlas Styles)
   ========================================================================== */

.formula-atlas-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease-out;
}

/* 顶部宣传 Banner */
.formula-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 24px 28px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  position: relative;
  overflow: hidden;
}

.formula-banner::after {
  content: "∑";
  position: absolute;
  right: -12px;
  bottom: -32px;
  font-size: 140px;
  font-family: serif;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  font-weight: 700;
}

.formula-banner-content {
  flex: 1;
  max-width: 680px;
}

.formula-banner-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
}

.formula-banner-pill .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 8px #60a5fa;
}

.formula-banner-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #f8fafc;
  line-height: 1.35;
}

.formula-banner-subtitle {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.6;
}

.formula-banner-stats {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.stat-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 18px;
  border-radius: 12px;
  min-width: 90px;
}

.stat-bubble .stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1.1;
}

.stat-bubble .stat-label {
  font-size: 11px;
  color: #cbd5e1;
  margin-top: 4px;
}

/* 工具栏与分类过滤 */
.formula-toolbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.formula-category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.formula-category-scroll::-webkit-scrollbar {
  display: none;
}

.formula-cat-pill {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.formula-cat-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.formula-cat-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.formula-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 260px;
  flex-shrink: 0;
}

.formula-search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 13px;
  color: #94a3b8;
  pointer-events: none;
}

.formula-search-input {
  width: 100%;
  padding: 8px 30px 8px 32px;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 13px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.formula-search-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.formula-search-box .search-clear-btn {
  position: absolute;
  right: 10px;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.formula-search-box .search-clear-btn:hover {
  background: #cbd5e1;
  color: #1e293b;
}

/* 公式卡片流 */
.formula-cards-stream {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.formula-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.formula-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
}

.formula-card-top {
  margin-bottom: 14px;
}

.formula-meta-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.formula-chapter-tag {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
}

.formula-stars {
  color: #f59e0b;
  font-size: 13px;
  letter-spacing: 1px;
}

.formula-freq-badge {
  font-size: 11px;
  font-weight: 600;
  color: #e11d48;
  background: #ffe4e6;
  border: 1px solid #fecdd3;
  padding: 2px 6px;
  border-radius: 4px;
}

.formula-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.4;
}

/* 公式展示框：现代轻量微渐变卡片，无单侧粗边框 */
.formula-equation-box {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px 14px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.formula-latex-wrap {
  overflow-x: auto;
  font-size: 17px;
  padding: 8px 0;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.formula-latex-wrap .katex-display {
  margin: 6px 0;
}

.formula-condition-tip {
  margin-top: 12px;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 8px 12px;
}

.formula-condition-tip .tip-label {
  font-weight: 600;
  color: #1e293b;
}

/* 大白话拆解与口语公式（四色笔记核心精髓） */
.formula-vernacular-card {
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1px solid #ccfbf1;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.03);
}

.vernacular-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.vernacular-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0d9488;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.vernacular-sub {
  font-size: 12px;
  color: #0f766e;
  font-weight: 500;
}

.vernacular-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vernacular-desc {
  margin: 0;
  font-size: 13.5px;
  color: #1e293b;
  line-height: 1.65;
}

.vernacular-spoken-box {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.04);
}

.spoken-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f766e;
  background: #ccfbf1;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.spoken-text {
  font-size: 13.5px;
  font-weight: 700;
  color: #115e59;
  letter-spacing: 0.2px;
  line-height: 1.5;
}

/* 变量与说明双栏 */
.formula-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.formula-detail-section {
  background: #fbfcfe;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  padding: 14px 16px;
}

.section-badge-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.formula-vars-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formula-var-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.formula-var-symbol {
  font-family: inherit;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.formula-var-desc {
  color: #334155;
  flex: 1;
}

/* 口诀与避坑 Callouts */
.formula-detail-section.tips-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tip-callout {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.callout-mnemonic {
  background: #fefce8;
  border: 1px solid #fef08a;
  color: #854d0e;
}

.callout-mnemonic .callout-header {
  font-weight: 700;
  color: #a16207;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.callout-pitfall {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

.callout-pitfall .callout-header {
  font-weight: 700;
  color: #be123c;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

/* 真题手把手求解折叠区 */
.formula-practice-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  transition: all 0.2s ease;
}

.formula-practice-box.expanded {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
}

.formula-practice-head {
  display: flex;
  width: 100%;
  border: none;
  font-family: inherit;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: #f1f5f9;
  text-align: left;
  transition: background 0.15s ease;
}

.formula-practice-head:hover {
  background: #e2e8f0;
}

.practice-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.practice-pill {
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.practice-hint-text {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.practice-toggle-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.practice-arrow {
  transition: transform 0.2s ease;
}

.practice-arrow.up {
  transform: rotate(180deg);
}

.formula-practice-body {
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.practice-stem {
  font-size: 14px;
  line-height: 1.6;
  color: #1e293b;
  font-weight: 500;
  margin-bottom: 12px;
}

.practice-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.practice-option-item {
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.practice-answer-bar {
  margin-bottom: 14px;
}

.practice-answer-tag {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
}

.practice-steps {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 12px 14px;
  border-radius: 8px;
}

.practice-steps-title {
  font-size: 13px;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 8px;
}

.practice-step-item {
  font-size: 13px;
  color: #334155;
  line-height: 1.6;
  margin-bottom: 6px;
}

.practice-step-item:last-child {
  margin-bottom: 0;
}

/* 底部操作条 */
.formula-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.btn-formula-practice-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-formula-practice-jump:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* 空状态 */
.formula-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
}

.formula-empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.formula-empty-state h3 {
  font-size: 16px;
  color: #1e293b;
  margin: 0 0 6px;
}

.formula-empty-state p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px;
}

.btn-clear-filter {
  background: #2563eb;
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .formula-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }

  .formula-banner-stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-bubble {
    flex: 1;
  }

  .formula-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .formula-search-box {
    width: 100%;
  }

  .formula-details-grid {
    grid-template-columns: 1fr;
  }

  .practice-options {
    grid-template-columns: 1fr;
  }

  .formula-card {
    padding: 16px;
  }
}
