/* style.css - 星轨健身 App 样式表 (Claude.com 温暖报刊级视觉风格) */

/* ================= 变量与主题定义 ================= */
:root {
  /* 基础字体 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: 'Cormorant Garamond', 'Copernicus', 'Tiempos Headline', 'Georgia', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'ui-monospace', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  
  /* 尺寸与动画 */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Claude 暗色模式变量 (默认) - 基于 deep warm charcoal */
body.dark-theme {
  --bg-primary: #181715;             /* surface-dark */
  --bg-secondary: #252320;           /* surface-dark-elevated */
  --bg-tertiary: #1f1e1b;            /* surface-dark-soft */
  --border-color: #2d2b27;           /* dark hairline */
  --text-primary: #faf9f5;           /* on-dark */
  --text-secondary: #a09d96;         /* on-dark-soft */
  --text-muted: #6c6a64;             /* muted */
  
  /* Claude 珊瑚红与暖黄日落渐变 */
  --accent-solid: #cc785c;           /* primary: warm coral */
  --accent-gradient: linear-gradient(135deg, #cc785c 0%, #e8a55a 100%);
  --accent-light: rgba(204, 120, 92, 0.15);
  
  /* 辅助状态色 */
  --success: #5db872;
  --success-bg: rgba(93, 184, 114, 0.15);
  --danger: #c64545;
  --danger-bg: rgba(198, 69, 69, 0.15);
  --warning: #e8a55a;
  
  /* 阴影与虚化 */
  --card-shadow: none;
  --dialog-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  --nav-shadow: none;
  --glass-bg: rgba(24, 23, 21, 0.85);
  --glass-border: #2d2b27;
}

/* Claude 亮色模式变量 - 温暖奶油报刊氛围 */
body.light-theme {
  --bg-primary: #faf9f5;             /* canvas: warm cream */
  --bg-secondary: #efe9de;           /* surface-card: light cream card */
  --bg-tertiary: #f5f0e8;            /* surface-soft */
  --border-color: #e6dfd8;           /* hairline */
  --text-primary: #141413;           /* ink */
  --text-secondary: #3d3d3a;         /* body */
  --text-muted: #6c6a64;             /* muted */
  
  /* Claude 珊瑚红与暖色渐变 */
  --accent-solid: #cc785c;           /* primary: warm coral */
  --accent-gradient: linear-gradient(135deg, #cc785c 0%, #a9583e 100%);
  --accent-light: rgba(204, 120, 92, 0.12);
  
  /* 辅助状态色 */
  --success: #5db872;
  --success-bg: rgba(93, 184, 114, 0.12);
  --danger: #c64545;
  --danger-bg: rgba(198, 69, 69, 0.12);
  --warning: #e8a55a;
  
  /* 阴影与虚化 */
  --card-shadow: 0 1px 3px rgba(20, 20, 19, 0.04);
  --dialog-shadow: 0 10px 40px rgba(20, 20, 19, 0.1);
  --nav-shadow: 0 -1px 3px rgba(20, 20, 19, 0.03);
  --glass-bg: rgba(250, 249, 245, 0.85);
  --glass-border: #e6dfd8;
}

/* ================= 基础复位与全局样式 ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* App 容器适配，支持手机端最大宽度 */
.app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ================= 头部 (Header) 样式 ================= */
.app-header {
  height: 64px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  z-index: 10;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-solid);
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 图标按钮 */
.icon-btn {
  background: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--text-secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ================= 主体区域 (Main & Views) ================= */
.app-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.app-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px 20px 80px 20px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--transition-normal), transform var(--transition-normal), visibility var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-view.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  position: relative;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* ================= 按钮与表单控件 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(204, 120, 92, 0.2);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-secondary-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary-outline:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--danger);
  border: 1px solid rgba(246, 109, 129, 0.3);
}

.btn-danger-outline:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-giant-primary {
  width: 100%;
  height: 64px;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  background: var(--accent-gradient);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(204, 120, 92, 0.25);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn-giant-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
}

.btn-giant-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(83, 145, 245, 0.5);
}

.btn-giant-primary:hover::after {
  animation: shine 1.5s infinite;
}

.btn-giant-primary:active {
  transform: translateY(0);
}

@keyframes shine {
  100% {
    transform: translateX(100%);
  }
}

/* ================= 1. 主页 (Home View) 样式 ================= */
.welcome-banner {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.welcome-banner h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.35;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.date-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* 卡片概述行 */
.stats-overview-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.overview-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--card-shadow);
}

.overview-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.card-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-icon-wrapper.blue {
  background-color: var(--accent-light);
  color: var(--accent-solid);
}

.card-icon-wrapper.purple {
  background-color: rgba(232, 165, 90, 0.15);
  color: var(--warning);
}

.card-icon-wrapper svg {
  width: 22px;
  height: 22px;
}

.card-info {
  display: flex;
  flex-direction: column;
}

.card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.card-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 2px;
}

/* 快捷操作网格 */
.quick-actions-section h2, .recent-records-section h2 {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.action-card {
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--card-shadow);
  width: 100%;
}

.action-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.action-card p {
  font-size: 0.8rem;
}

.primary-action {
  background: var(--accent-gradient);
  color: white;
}

.primary-action p {
  color: rgba(255, 255, 255, 0.8);
}

.primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(83, 145, 245, 0.35);
}

.secondary-action {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.secondary-action p {
  color: var(--text-muted);
}

.secondary-action:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.action-icon {
  font-size: 1.8rem;
}

/* 最近记录列表 */
.recent-records-section {
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--accent-solid);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.recent-list-empty, .recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  background-color: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.record-item-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.record-info-left h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.record-info-left span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.record-info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.record-duration-tag {
  background-color: var(--accent-light);
  color: var(--accent-solid);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.record-sets-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ================= 2. 计划管理 (Plans View) ================= */
.plans-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.plan-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--card-shadow);
  transition: border-color var(--transition-fast);
}

.plan-card:hover {
  border-color: var(--accent-solid);
}

.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.plan-card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.plan-ex-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-card-actions {
  display: flex;
  gap: 4px;
}

.plan-exercises-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.preview-ex-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.preview-ex-meta {
  color: var(--text-muted);
  font-weight: 500;
}

.plan-card-footer {
  display: flex;
  justify-content: flex-end;
}

/* ================= 3. 训练页面 (Workout View) ================= */
.workout-view-mode {
  padding-bottom: 60px; /* Hide navigation bar or overlap correctly; added comfortable scrolling room */
  gap: 16px; /* Reduced gap from 24px to fit better on standard mobile screens */
  z-index: 5;
}

.workout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* Prevent header from shrinking */
}

.workout-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.workout-plan-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.workout-timer {
  font-family: 'Outfit', var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

/* 进度条 */
.workout-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0; /* Prevent progress bar from shrinking */
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-bg {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 动作主卡片 */
.active-exercise-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px; /* Compact padding for mobile screens */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px; /* Compact gap for mobile screens */
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  flex-shrink: 0; /* Prevent card from shrinking and clipping the weight module */
}

.active-exercise-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--accent-gradient);
}

.ex-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sets-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.set-counter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.set-numbers {
  font-family: 'Outfit', var(--font-sans);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.current-set-num {
  color: var(--accent-solid);
}

.divider {
  color: var(--border-color);
  margin: 0 4px;
}

.total-set-num {
  color: var(--text-primary);
}

.sets-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.set-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  transition: all var(--transition-fast);
}

.set-dot.completed {
  background-color: var(--success);
  border-color: var(--success);
  transform: scale(1.1);
}

.set-dot.active {
  background-color: var(--accent-solid);
  border-color: var(--accent-solid);
  box-shadow: 0 0 8px var(--accent-solid);
}

.next-up-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.next-up-info strong {
  color: var(--text-primary);
}

.workout-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0; /* Prevent actions panel from shrinking */
}

.workout-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ================= 组间休息浮层 ================= */
.rest-overlay-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 15;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  padding: 24px 20px;
}

.rest-overlay-panel.active {
  opacity: 1;
  visibility: visible;
}

.rest-panel-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 30px;
}

.rest-title {
  font-family: 'Outfit', var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rest-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 280px;
}

/* 圆形计时器 */
.timer-circle-container {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-circle-svg {
  width: 200px;
  height: 200px;
}

.timer-circle-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 8;
}

.timer-circle-bar {
  fill: none;
  stroke: var(--accent-solid);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear;
}


.timer-time-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seconds-num {
  font-family: 'Outfit', var(--font-sans);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.seconds-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.rest-actions {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

.rest-actions .btn {
  flex: 1;
}

/* ================= 4. 数据统计 (Stats View) ================= */
.stats-tabs {
  display: flex;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.stats-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stats-tab-btn.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.stat-num-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.stat-num-value {
  font-family: 'Outfit', var(--font-sans);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-num-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.chart-section-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-section-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

/* SVG 图表样式 */
#stats-chart {
  display: block;
}

.chart-axis-line {
  stroke: var(--border-color);
  stroke-width: 1;
}

.chart-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.5;
}

.chart-bar {
  fill: var(--accent-solid);
  rx: 4;
  transition: height 0.5s ease, y 0.5s ease;
}

.chart-bar:hover {
  fill: var(--warning);
  filter: drop-shadow(0 0 4px rgba(232, 165, 90, 0.4));
}

.chart-label-text {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

.chart-value-text {
  font-family: 'Outfit', var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  fill: var(--text-primary);
  text-anchor: middle;
}

/* 分栏统计 */
.stats-two-columns {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-column-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-column-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.frequency-list, .history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.empty-state-small {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
}

.freq-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.freq-name {
  font-weight: 600;
}

.freq-bar-wrapper {
  flex: 1;
  margin: 0 16px;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.freq-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
}

.freq-count {
  font-weight: 700;
  color: var(--accent-solid);
}

.hist-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  position: relative;
  font-size: 0.85rem;
}

.hist-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.hist-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hist-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.hist-delete-btn:hover {
  color: var(--danger);
  background-color: var(--danger-bg);
}

.hist-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.hist-notes {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-left: 2px solid var(--accent-solid);
  padding-left: 6px;
  margin-top: 4px;
  font-style: italic;
}

/* ================= 底部导航 (App Nav) ================= */
.app-nav {
  height: 64px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  box-shadow: var(--nav-shadow);
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--accent-solid);
}

.nav-tab svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
}

.nav-tab.active svg {
  transform: translateY(-2px);
  stroke: var(--accent-solid);
}

.nav-tab span {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ================= 弹窗 (Dialogs) 样式 ================= */
.modern-dialog {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 0;
  margin: auto;
  box-shadow: var(--dialog-shadow);
  color: var(--text-primary);
  width: calc(100% - 32px);
  max-width: 400px;
  outline: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modern-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

/* 弹窗遮罩背景 */
.modern-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

.wide-dialog {
  max-width: 440px;
}

.dialog-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.close-dialog-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.close-dialog-btn:hover {
  color: var(--text-primary);
}

.dialog-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.dialog-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions .btn {
  min-width: 80px;
}

/* 表单组样式 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent-solid);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.inline-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

.size-small input {
  text-align: center;
}

/* 动作建造器段落 */
.exercises-builder-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.builder-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
}

.sub-form-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-form-card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-solid);
}

.sub-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.builder-exercises-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.builder-ex-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.builder-ex-info h5 {
  font-size: 0.85rem;
  font-weight: 600;
}

.builder-ex-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.builder-ex-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.action-icon-btn.delete:hover {
  color: var(--danger);
  background-color: var(--danger-bg);
}

.action-icon-btn svg {
  width: 14px;
  height: 14px;
}

/* 总结展示 */
.trophy-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 8px;
}

.trophy-emoji {
  font-size: 4rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-12px);
  }
  60% {
    transform: translateY(-6px);
  }
}

.trophy-showcase h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.summary-details {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.summary-item .label {
  color: var(--text-muted);
  font-weight: 500;
}

.summary-item .val {
  font-weight: 700;
  color: var(--text-primary);
}

/* ================= 辅助类 ================= */
.hidden {
  display: none !important;
}

.empty-state, .empty-state-small {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= 重量记录与趋势图新版样式 ================= */
.workout-weight-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 260px;
  margin-top: 6px; /* Slightly reduced margin-top */
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
}

.weight-label-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.last-weight-label {
  color: var(--accent-solid);
  font-weight: 600;
}

.weight-control-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.weight-adjust-btn {
  flex: 1;
  min-width: 38px;
  height: 38px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  outline: none;
  user-select: none;
}

.weight-adjust-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.weight-adjust-btn:active {
  transform: scale(0.95);
}

#workout-weight-input {
  width: 100px;
  text-align: center;
  font-family: 'Outfit', var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  height: 38px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  outline: none;
  -moz-appearance: textfield;
}

#workout-weight-input::-webkit-outer-spin-button,
#workout-weight-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.weight-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

/* 重量曲线相关 */
.modern-select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 28px 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2388888b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

body.dark-theme .modern-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.modern-select:focus {
  border-color: var(--accent-solid);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.chart-line {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area-path {
  fill-opacity: 0.15;
  stroke: none;
}

.chart-dot {
  fill: var(--bg-secondary);
  stroke: var(--accent-solid);
  stroke-width: 2.5;
  transition: r 0.2s ease, stroke-width 0.2s ease;
  cursor: pointer;
}

.chart-dot:hover {
  r: 7;
  stroke-width: 3.5;
}

/* 训练进行中项目选择器 */
.workout-selector-row {
  margin-top: 10px; /* Reduced from 15px */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  flex-shrink: 0; /* Prevent switching bar from shrinking */
}

.workout-selector-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.workout-selector-select {
  flex: 1;
  max-width: 220px;
  font-size: 0.85rem;
  padding: 6px 28px 6px 12px;
  height: 34px;
}

/* 按钮禁用状态样式 */
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--bg-tertiary) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
  box-shadow: none !important;
}

/* ================= 4. 用户登录与管理模块样式 ================= */
.login-view-mode {
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  height: 100%;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-form-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 退出登录状态隐藏界面顶底栏 */
body.logged-out .app-header,
body.logged-out .app-nav {
  display: none !important;
}

body.logged-out .app-main {
  height: 100vh;
}

/* 用户管理表格样式 */
.user-table th, .user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.user-table tbody tr:hover {
  background-color: var(--bg-tertiary);
}

.btn-sm-danger {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-sm-danger:hover {
  background-color: var(--danger);
  color: #ffffff;
}

