/* ============================================
   音乐考研打卡系统 - 自定义样式
   补充 Tailwind 的自定义部分
   ============================================ */

:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #e53e3e;
  --bg: #f7fafc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #e0e7ff 0%, #c3cfe2 100%);
  min-height: 100vh;
  padding-bottom: 80px;
}

.bg-gradient {
  background: linear-gradient(135deg, #e0e7ff 0%, #c3cfe2 100%);
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 2px 12px rgba(102,126,234,0.2);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-icon { font-size: 22px; }

.date-display {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 500;
}

/* ── Main ── */
.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Bottom Nav ── */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  display: flex;
  z-index: 100;
  max-width: 900px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  padding: 10px 4px 8px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-light);
  transition: all 0.2s ease;
  font-family: inherit;
}

.nav-item svg { width: 22px; height: 22px; }

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

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.active svg { stroke-width: 2.5; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 5px;
  transition: width 0.5s ease;
}

/* ── Task Cards ── */
.task-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
}

.task-card.checked {
  border-left-color: var(--success);
  background: #f0fff4;
}

.task-card .task-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  min-width: 90px;
  white-space: nowrap;
}

.task-card .task-body {
  flex: 1;
  min-width: 0;
}

.task-card .task-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.task-card .task-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.4;
}

.task-card .category-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}

.tag-theory { background: #e6fffa; color: #2c7a7b; }
.tag-vocal { background: #fef3c7; color: #92400e; }
.tag-english { background: #ebf8ff; color: #2c5282; }
.tag-politics { background: #fff5f5; color: #c53030; }
.tag-break { background: #f0f0f0; color: #555; }

/* ── Check Button ── */
.check-btn {
  min-width: 52px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.check-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.check-btn.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px rgba(72,187,120,0.3);
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ── Timer Button ── */
.timer-btn {
  min-width: 52px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
  flex-shrink: 0;
  margin-right: 4px;
}

.timer-btn:hover {
  border-color: var(--primary);
  background: #f0f4ff;
}

.timer-btn.active {
  background: var(--warning);
  border-color: var(--warning);
  color: #fff;
}

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

@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Calendar ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.cal-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.cal-cell:hover { transform: scale(1.08); z-index: 5; }
.cal-cell .cal-day { font-size: 13px; }
.cal-cell .cal-dot {
  width: 6px; height: 6px; border-radius: 50%; margin-top: 2px;
}

.cal-empty { background: transparent; cursor: default; }
.cal-empty:hover { transform: none; }
.cal-future { background: #f7fafc; color: #cbd5e0; }
.cal-none { background: #fff5f5; color: #fc8181; }
.cal-partial { background: #fef3c7; color: #d69e2e; }
.cal-full { background: #c6f6d5; color: #2f855a; }
.cal-today { box-shadow: 0 0 0 2px var(--primary); }

.cal-header {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  padding: 4px 0;
}

/* ── Buttons ── */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

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

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover { background: #f0f4ff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.modal .form-group {
  margin-bottom: 14px;
}

.modal label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Loading Mask ── */
.loading-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.loading-mask.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #2d3748;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toastIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Misc ── */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 2px;
}

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

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

.hidden { display: none !important; }

.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-light); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ============================================
   登录/注册页样式 v2
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.4s ease;
}

.login-logo {
  text-align: center;
  font-size: 48px;
  margin-bottom: 12px;
}

.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.login-form .btn-primary {
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 8px;
}

.login-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 20px;
}

.login-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.login-switch a:hover {
  text-decoration: underline;
}

/* ── 用户端 header 用户信息 ── */
.user-name {
  color: rgba(255,255,255,0.95);
  font-size: 14px;
  font-weight: 600;
  margin: 0 8px;
}

.admin-link {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s;
}

.admin-link:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ── 管理后台 header ── */
.admin-back-link {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  text-decoration: none;
}

.admin-back-link:hover {
  color: #fff;
}
