/**
 * style.css - 喵喵钟应用样式表
 *
 * 设计原则：
 * 1. 简洁清爽，专注于计时功能
 * 2. 响应式设计，支持移动端
 * 3. 使用柔和的颜色，减少视觉疲劳
 * 4. 动画效果平滑，不干扰注意力
 */

/* ==================== 全局样式 ==================== */

/* 默认色系：环保温柔色系（森林绿） */
:root {
  --primary-color: #4A5D4E;      /* 主色：森林绿 */
  --success-color: #6B8E7E;      /* 成功：浅森林绿 */
  --warning-color: #D4A373;      /* 警告：落叶黄 */
  --danger-color: #8B5A3C;       /* 危险：深褐 */

  --bg-color: #F9F7F2;           /* 背景色：米白色 */
  --card-bg: #FFFFFF;            /* 卡片背景 */
  --muted-bg: #E9EDC6;           /* 辅助背景：淡橄榄绿 */
  --text-color: #3D4A3D;         /* 文字颜色：深绿灰 */
  --text-light: #7A8B7E;         /* 浅色文字 */
  --border-color: #D4DCC8;       /* 边框颜色 */

  --shadow: 0 2px 10px rgba(74, 93, 78, 0.1);  /* 阴影 */
  --shadow-hover: 0 4px 20px rgba(74, 93, 78, 0.15);  /* 悬停阴影 */

  --border-radius: 8px;          /* 圆角 */
  --transition: all 0.3s ease;   /* 过渡动画 */
}

/* 温柔粉色系 */
body[data-color-scheme="pink"] {
  --primary-color: #F4B8B8;      /* 主色：烟粉色 */
  --success-color: #FF8E9E;      /* 成功：珊瑚粉 */
  --warning-color: #FFB6A3;      /* 警告：蜜桃粉 */
  --danger-color: #E89C9C;       /* 危险：深粉 */

  --bg-color: #FFF9F5;           /* 背景色：奶油色 */
  --card-bg: #FFFFFF;            /* 卡片背景 */
  --muted-bg: #EAD8C0;           /* 辅助背景：柔砂色 */
  --text-color: #4A4343;         /* 文字颜色：深咖灰 */
  --text-light: #8B7E7E;         /* 浅色文字 */
  --border-color: #E8D5C4;       /* 边框颜色 */

  --shadow: 0 2px 10px rgba(244, 184, 184, 0.15);  /* 阴影 */
  --shadow-hover: 0 4px 20px rgba(244, 184, 184, 0.25);  /* 悬停阴影 */
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== 通用组件 ==================== */

/* 页面容器 */
.page {
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* 按钮样式 */
.btn {
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  background-color: var(--card-bg);
  color: var(--text-color);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

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

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

.btn-success {
  background-color: var(--success-color);
  color: white;
  border: none;
}

.btn-warning {
  background-color: var(--warning-color);
  color: white;
  border: none;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
  border: none;
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

/* 表单元素 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  background-color: var(--card-bg);
  color: var(--text-color);
  transition: var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 93, 78, 0.15);
}

/* ==================== 登录页面 ==================== */

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

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

.login-container h1 {
  font-size: 32px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.subtitle {
  color: var(--text-light);
  margin-bottom: 40px;
}

.login-form {
  background: var(--card-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.pin-input {
  width: 100%;
  font-size: 24px;
  text-align: center;
  letter-spacing: 8px;
}

.hint {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
}

.error-message {
  background-color: #F5EDE6;
  color: var(--danger-color);
  padding: 10px;
  border-radius: var(--border-radius);
  margin-bottom: 15px;
  font-size: 14px;
}

.switch-form {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-light);
}

.switch-form a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.switch-form a:hover {
  color: var(--warning-color);
  text-decoration: underline;
}

/* ==================== 导航栏 ==================== */

.navbar {
  background: var(--card-bg);
  padding: 15px 20px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  transition: transform 0.3s ease;
}

.navbar.hidden {
  display: none;
}

/* 循环进度条（仅在计时器页面显示） */
.cycle-progress {
  width: 100%;
  margin: 0 auto 20px auto;
}

.nav-brand {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  gap: 10px;
}

.nav-link {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
}

.nav-link:hover {
  background: var(--bg-color);
}

.nav-link.active {
  background: var(--primary-color);
  color: white;
}

/* ==================== 计时器页面 ==================== */

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 70px);
  padding: 20px;
  transition: min-height 0.3s ease, padding 0.3s ease;
}

/* 专注模式下的计时器容器 */
body.focus-mode .timer-container {
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 40px;
}

body.focus-mode .timer-type-badge {
  margin-bottom: 30px;
}

body.focus-mode .timer-display {
  font-size: 140px;
}

body.focus-mode .timer-controls {
  margin-bottom: 40px;
}

body.focus-mode .timer-controls button {
  min-width: 140px;
  font-size: 20px;
  padding: 15px 30px;
}

.timer-type-badge {
  background: var(--primary-color);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  margin-bottom: 20px;
  font-size: 14px;
}

.cycle-progress-svg {
  width: 100%;
  height: 40px;
  display: block;
}

/* 颜色块 */
.cycle-block {
  transition: opacity 0.3s ease;
  stroke: var(--card-bg);
  stroke-width: 1;
}

.cycle-block.completed {
  opacity: 0.5;
}

.cycle-block.current {
  opacity: 1;
  filter: brightness(1.1);
}

/* 指针 */
.cycle-pointer {
  transition: transform 0.5s ease;
}

.cycle-pointer line {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* 中心标签 */
.cycle-label {
  margin-top: 8px;
  text-align: center;
  pointer-events: none;
}

.cycle-label-count {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
}

.timer-display {
  font-size: 120px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 30px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-colon {
  /* 移除跳动动画效果 */
}

.current-task {
  background: var(--card-bg);
  padding: 10px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  color: var(--text-light);
}

.timer-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
}

.timer-controls button {
  min-width: 120px;
  font-size: 18px;
}

.task-selector {
  margin-bottom: 30px;
}

.task-select {
  padding: 10px 20px;
  font-size: 16px;
  min-width: 250px;
}

.today-summary {
  display: flex;
  gap: 30px;
  margin-top: 40px;
}

.summary-item {
  text-align: center;
}

.summary-label {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 5px;
}

.summary-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

/* 计时器页面的任务列表 */
.timer-tasks-section {
  margin-top: 40px;
  width: 100%;
  max-width: 400px;
}

.timer-tasks-title {
  font-size: 18px;
  color: var(--text-color);
  margin-bottom: 20px;
  text-align: center;
}

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

.timer-task-item {
  background: var(--card-bg);
  padding: 15px 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
  cursor: pointer;
}

.timer-task-item:hover {
  box-shadow: var(--shadow-hover);
}

.timer-task-item.completed {
  opacity: 0.6;
}

.timer-task-item.completed .timer-task-title {
  text-decoration: line-through;
  color: var(--text-light);
}

.timer-task-checkbox {
  width: 24px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}

.timer-task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timer-task-title {
  font-size: 16px;
  color: var(--text-color);
}

.timer-task-pomos {
  font-size: 13px;
  color: var(--text-light);
}

.timer-task-empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
}

/* ==================== 任务页面 ==================== */

.task-form {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.task-form input[type="text"] {
  flex: 1;
}

.task-form input[type="number"] {
  width: 80px;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.task-item {
  background: var(--card-bg);
  padding: 15px 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
}

.task-item:hover {
  box-shadow: var(--shadow-hover);
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-title {
  text-decoration: line-through;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.task-title {
  flex: 1;
  font-size: 16px;
}

.task-pomodoros {
  font-size: 14px;
  color: var(--text-light);
}

.task-actions {
  display: flex;
  gap: 10px;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  opacity: 0.6;
  transition: var(--transition);
}

.btn-icon:hover {
  opacity: 1;
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 40px;
}

/* ==================== 统计页面 ==================== */

.stats-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.stats-tab {
  padding: 10px 20px;
  border: 2px solid var(--border-color);
  background: transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
}

.stats-tab:hover {
  border-color: var(--primary-color);
}

.stats-tab.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--card-bg);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.stat-label {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: var(--primary-color);
}

/* ==================== 设置页面 ==================== */

.settings-form {
  max-width: 600px;
  margin: 0 auto;
}

.settings-section {
  background: var(--card-bg);
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.settings-section h3 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

.settings-section .form-group {
  margin-bottom: 20px;
}

.settings-section input[type="number"],
.settings-section select {
  width: 100%;
  max-width: 300px;
}

.settings-section input[type="checkbox"] {
  margin-right: 10px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.help-text {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 5px;
  margin-left: 28px;
}

/* ==================== 全局提示 ==================== */

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  box-shadow: var(--shadow-hover);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==================== 内容页面切换 ==================== */

.content-page {
  display: none;
}

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

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .timer-display {
    font-size: 80px;
  }

  .timer-controls {
    flex-direction: column;
    width: 100%;
  }

  .timer-controls button {
    width: 100%;
  }

  .task-form {
    flex-direction: column;
  }

  .task-form input[type="number"] {
    width: 100%;
  }

  .stats-cards {
    grid-template-columns: 1fr;
  }

  .today-summary {
    flex-direction: column;
    gap: 15px;
  }
}
