/* ============================================================
   Fox Insight Card — 小狐狸洞察卡片
   可折叠信息卡片，4 种主题色 + 暗黑模式
   ============================================================ */

/* ---- 卡片容器 ---- */
.fox-insight-card {
  width: 100%;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin: 4px 0 16px;
}

/* ---- 折叠头部 ---- */
.fox-insight-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-align: left;
  font-family: inherit;
  color: var(--text, #182132);
}

.fox-insight-toggle:active {
  opacity: 0.7;
}

/* ---- 左侧图标 ---- */
.fox-insight-icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ---- 标题文字 ---- */
.fox-insight-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text, #182132);
}

/* ---- 展开/收起箭头 ---- */
.fox-insight-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease-out;
  opacity: 0.45;
}

.fox-insight-chevron svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fox-insight-chevron.expanded {
  transform: rotate(90deg);
}

/* ---- 内容区域 ---- */
.fox-insight-body {
  padding: 0 12px 12px;
}

.fox-insight-body p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted, #7d8aa3);
}

.fox-insight-body p:last-child {
  margin-bottom: 0;
}

/* ---- CTA 按钮 ---- */
.fox-insight-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  margin-top: 8px;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
  color: #fff;
  width: 100%;
  text-decoration: none;
}

.fox-insight-cta:active {
  opacity: 0.8;
  transform: scale(0.98);
}

/* ============================================================
   主题色 — 亮色模式
   ============================================================ */

/* progress — 蓝色系 */
.fox-insight-card.progress {
  background: rgba(79, 143, 247, 0.06);
  border-color: rgba(79, 143, 247, 0.15);
}
.fox-insight-card.progress .fox-insight-title {
  color: #3a7be0;
}
.fox-insight-card.progress .fox-insight-cta {
  background: linear-gradient(135deg, #4f8ff7, #6ca6ff);
  box-shadow: 0 2px 8px rgba(79, 143, 247, 0.25);
}

/* warning — 橙色系 */
.fox-insight-card.warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.15);
}
.fox-insight-card.warning .fox-insight-title {
  color: #d48806;
}
.fox-insight-card.warning .fox-insight-cta {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

/* celebrate — 绿色系 */
.fox-insight-card.celebrate {
  background: rgba(43, 200, 102, 0.06);
  border-color: rgba(43, 200, 102, 0.15);
}
.fox-insight-card.celebrate .fox-insight-title {
  color: #1ea355;
}
.fox-insight-card.celebrate .fox-insight-cta {
  background: linear-gradient(135deg, #2bc866, #4dd88a);
  box-shadow: 0 2px 8px rgba(43, 200, 102, 0.25);
}

/* tip — 紫色系 */
.fox-insight-card.tip {
  background: rgba(139, 108, 246, 0.06);
  border-color: rgba(139, 108, 246, 0.15);
}
.fox-insight-card.tip .fox-insight-title {
  color: #7c5ce0;
}
.fox-insight-card.tip .fox-insight-cta {
  background: linear-gradient(135deg, #8b6cf6, #a78bfa);
  box-shadow: 0 2px 8px rgba(139, 108, 246, 0.25);
}

/* ============================================================
   暗黑模式
   ============================================================ */

[data-theme="dark"] .fox-insight-card {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .fox-insight-toggle {
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .fox-insight-title {
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .fox-insight-body p {
  color: rgba(255, 255, 255, 0.55);
}

/* progress — 暗色 */
[data-theme="dark"] .fox-insight-card.progress {
  background: rgba(79, 143, 247, 0.1);
  border-color: rgba(79, 143, 247, 0.2);
}
[data-theme="dark"] .fox-insight-card.progress .fox-insight-title {
  color: rgba(108, 166, 255, 0.95);
}

/* warning — 暗色 */
[data-theme="dark"] .fox-insight-card.warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}
[data-theme="dark"] .fox-insight-card.warning .fox-insight-title {
  color: rgba(251, 191, 36, 0.95);
}

/* celebrate — 暗色 */
[data-theme="dark"] .fox-insight-card.celebrate {
  background: rgba(43, 200, 102, 0.1);
  border-color: rgba(43, 200, 102, 0.2);
}
[data-theme="dark"] .fox-insight-card.celebrate .fox-insight-title {
  color: rgba(77, 216, 138, 0.95);
}

/* tip — 暗色 */
[data-theme="dark"] .fox-insight-card.tip {
  background: rgba(139, 108, 246, 0.1);
  border-color: rgba(139, 108, 246, 0.2);
}
[data-theme="dark"] .fox-insight-card.tip .fox-insight-title {
  color: rgba(167, 139, 250, 0.95);
}

/* ============================================================
   Vue transition — 折叠动画
   ============================================================ */

.fox-slide-enter-active,
.fox-slide-leave-active {
  transition: max-height 0.2s ease-out, opacity 0.2s ease-out;
  overflow: hidden;
}

.fox-slide-enter,
.fox-slide-leave-to {
  max-height: 0;
  opacity: 0;
}

.fox-slide-enter-to,
.fox-slide-leave {
  max-height: 300px;
  opacity: 1;
}

/* ---- 无障碍：关闭动画 ---- */
@media (prefers-reduced-motion: reduce) {
  .fox-slide-enter-active,
  .fox-slide-leave-active {
    transition: none;
  }
  .fox-insight-chevron {
    transition: none;
  }
}

/* ── 结构化数据（音素 badge + 易错词 + 本周趋势） ── */
.fox-insight-text { font-size: 0.84rem; line-height: 1.55; color: var(--muted); margin-bottom: 8px; }
.fox-insight-detail { font-size: 0.8rem; color: var(--muted, #999); margin-bottom: 8px; }
.fox-insight-section { margin-top: 10px; }
.fox-insight-section-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.fox-insight-weekly { font-size: 0.84rem; line-height: 1.55; color: var(--text); }
.fox-insight-phonemes, .fox-insight-hardwords {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.fox-insight-ph-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 10px; border-radius: 16px;
  background: rgba(255, 100, 50, 0.1); color: #e54;
  font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.fox-insight-ph-badge small { font-size: 0.68rem; opacity: 0.7; font-weight: 600; }
.fox-insight-ph-badge:active { background: rgba(255, 100, 50, 0.2); }
.fox-insight-hw-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 10px; border-radius: 14px;
  background: rgba(79, 143, 255, 0.1); color: var(--blue, #4f8fff);
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.fox-insight-hw-badge small { font-size: 0.68rem; opacity: 0.6; }
.fox-insight-hw-badge:active { background: rgba(79, 143, 255, 0.2); }
[data-theme="dark"] .fox-insight-ph-badge { background: rgba(255, 100, 50, 0.15); color: #ff8866; }
[data-theme="dark"] .fox-insight-hw-badge { background: rgba(79, 143, 255, 0.15); }

/* ---- Action 按钮行 ---- */
.fox-insight-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.fox-insight-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1.5px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 12px;
  background: var(--surface, #fff);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--blue, #4f8ff7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}
.fox-insight-action-btn:active {
  opacity: 0.75;
  transform: scale(0.97);
}
[data-theme="dark"] .fox-insight-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(108, 166, 255, 0.95);
}

/* ============================================================
   T4 疲劳遮罩
   ============================================================ */

.fox-fatigue-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 24px;
  /* 突破 #app overflow:hidden 限制：独立合成层 */
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.fox-fatigue-card {
  text-align: center;
  max-width: 320px;
  width: 100%;
}
.fox-fatigue-emoji {
  font-size: 3rem;
  line-height: 1.2;
  margin-bottom: 16px;
}
.fox-fatigue-text {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text, #182132);
  margin-bottom: 8px;
}
.fox-fatigue-sub {
  font-size: 0.88rem;
  color: var(--muted, #7d8aa3);
  margin-bottom: 24px;
  line-height: 1.5;
}
.fox-fatigue-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fox-fatigue-btn {
  min-height: 48px;
  padding: 12px 24px;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.15s;
}
.fox-fatigue-btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}
.fox-fatigue-rest {
  background: linear-gradient(135deg, #4f8ff7, #6ca6ff);
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 143, 247, 0.25);
}
.fox-fatigue-continue {
  background: transparent;
  border: 1.5px solid var(--border, rgba(0,0,0,0.1));
  color: var(--muted, #7d8aa3);
}

/* 暗色模式 */
[data-theme="dark"] .fox-fatigue-overlay {
  background: rgba(0, 0, 0, 0.75);
}
[data-theme="dark"] .fox-fatigue-text {
  color: rgba(255, 255, 255, 0.92);
}
[data-theme="dark"] .fox-fatigue-sub {
  color: rgba(255, 255, 255, 0.55);
}
[data-theme="dark"] .fox-fatigue-continue {
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================================
   移动端适配
   ============================================================ */

@media (max-width: 480px) {
  .fox-insight-toggle {
    padding: 8px 10px;
  }
  .fox-insight-body {
    padding: 0 10px 10px;
  }
  .fox-insight-title {
    font-size: 0.85rem;
  }
  .fox-insight-body p {
    font-size: 0.82rem;
  }
}
