/* FitCoach AI - 样式表 v3.0 */

/* ==================== 基础样式 ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f5f7fa;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ==================== 冷启动页面 ==================== */

.onboarding-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 20px;
  text-align: center;
  color: white;
}

.logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.onboarding-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.onboarding-header p {
  opacity: 0.9;
}

.onboarding-form {
  padding: 20px;
}

.form-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #667eea;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

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

.goal-option input {
  display: none;
}

.goal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.goal-option input:checked + .goal-card {
  border-color: #667eea;
  background: #f0f4ff;
}

.goal-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.goal-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.goal-desc {
  font-size: 12px;
  color: #666;
  text-align: center;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

/* ==================== 主页面布局 ==================== */

.header {
  background: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.content {
  padding-bottom: 80px;
}

.tab-content {
  display: none;
  padding: 20px;
}

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

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

.page-header h2 {
  font-size: 20px;
}

.btn-outline {
  padding: 8px 16px;
  border: 1px solid #667eea;
  border-radius: 20px;
  background: white;
  color: #667eea;
  font-size: 14px;
  cursor: pointer;
}

/* ==================== 计划页 v3.0 ==================== */

.plan-goals {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.goal-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.goal-card .goal-icon {
  font-size: 24px;
  margin-bottom: 0;
}

.goal-content {
  flex: 1;
}

.goal-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.goal-text {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.goal-item {
  padding: 4px 0;
}

/* 周训练表格 */

.weekly-schedule {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.weekly-schedule h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.schedule-table {
  overflow-x: auto;
}

.schedule-header,
.schedule-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.schedule-cell {
  padding: 8px 4px;
  text-align: center;
  border-radius: 8px;
  min-height: 80px;
}

.schedule-header .schedule-cell {
  font-weight: 600;
  color: #666;
  font-size: 12px;
  min-height: auto;
  padding: 4px;
}

.workout-type {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

.workout-exercises {
  font-size: 10px;
  color: #666;
  line-height: 1.3;
}

.schedule-cell.workout {
  background: #e8f5e9;
}

.schedule-cell.rest {
  background: #f5f5f5;
}

.schedule-cell.today {
  border: 2px solid #667eea;
}

.schedule-cell.empty {
  background: #fafafa;
  color: #ccc;
}

/* 计划详情 */

.plan-details {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.plan-details h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.phases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phase-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.phase-weeks {
  font-size: 12px;
  color: #667eea;
  font-weight: 600;
  white-space: nowrap;
}

.phase-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.phase-desc {
  font-size: 12px;
  color: #666;
}

.plan-tips {
  margin-top: 12px;
  padding: 12px;
  background: #fff3e0;
  border-radius: 8px;
  font-size: 13px;
  color: #e65100;
}

/* ==================== 周期页 v3.0 ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card.highlight {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  opacity: 0.8;
}

.performance-summary,
.coach-recommendation {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.performance-summary h3,
.coach-recommendation h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.summary-text,
.recommendation-text {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* ==================== 我的页 ==================== */

.profile-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 20px;
  text-align: center;
  color: white;
}

.avatar-large {
  font-size: 64px;
  margin-bottom: 12px;
}

.profile-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.profile-header p {
  opacity: 0.9;
}

.profile-info {
  background: white;
  margin: -20px 20px 20px;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  color: #666;
}

.info-value {
  font-weight: 600;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 20px;
}

/* ==================== 底部导航 ==================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  z-index: 10;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #999;
  padding: 4px 16px;
}

.nav-item.active {
  color: #667eea;
}

.nav-icon {
  font-size: 24px;
}

.nav-label {
  font-size: 12px;
}

/* ==================== 聊天弹窗 ==================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
}

.modal.active {
  display: flex;
  flex-direction: column;
  background: #f5f7fa;
}

.modal-header {
  background: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.modal-header h3 {
  font-size: 18px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chat-container .welcome {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.chat-container .welcome .hint {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
}

.chat-message {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message .avatar {
  font-size: 24px;
}

.chat-message .message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.user .message-content {
  background: #667eea;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  background: white;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.confirm-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-confirm,
.btn-cancel {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.btn-confirm {
  background: #667eea;
  color: white;
}

.btn-cancel {
  background: #f0f0f0;
  color: #666;
}

.input-area {
  background: white;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.input-wrapper {
  display: flex;
  gap: 8px;
}

.input-wrapper input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
}

.send-btn {
  padding: 12px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
}

/* ==================== 响应式 ==================== */

@media (max-width: 360px) {
  .goal-options {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}