/* 智能日程规划 Agent 前端样式 */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --radius: 10px;
  /* 优先级颜色 */
  --w10: #ef4444;  /* 必修/实训 */
  --w9: #f97316;   /* 备考 */
  --w8: #eab308;   /* 竞赛 */
  --w4: #3b82f6;   /* 选修 */
  --w2: #9ca3af;   /* 休闲 */
  --course: #14b8a6; /* 课表 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.hidden { display: none !important; }

/* ===== 登录页 ===== */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(129, 140, 248, 0.6) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(167, 139, 250, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.4) 0%, transparent 70%),
    #4f46e5;
  position: relative;
  padding: 24px;
}
.login-bg-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.9;
}
.login-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 48px 42px;
  border-radius: 20px;
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.15),
    0 10px 30px -10px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  width: 410px;
  max-width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 22px;
  opacity: 0.92;
}
.login-logo svg {
  width: 100%;
  height: 100%;
}
.login-card h1 {
  font-size: 24px;
  margin-bottom: 10px;
  color: #1f2937;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.subtitle {
  color: #6b7280;
  font-size: 15px;
  margin-bottom: 24px;
  font-weight: 400;
}
.feature-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
}
.feature-tag {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ===== 登录表单 ===== */
.login-form { gap: 14px; }
.login-form input {
  padding: 13px 16px;
  border: 1.5px solid rgba(229, 231, 235, 0.8);
  border-radius: 10px;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: rgba(255, 255, 255, 0.7);
  color: #1f2937;
}
.login-form input:hover {
  border-color: rgba(156, 163, 175, 0.8);
}
.login-form input:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.login-form input::placeholder {
  color: #9ca3af;
}
.btn-login {
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
  margin-top: 10px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-login:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-login:active {
  transform: translateY(0);
  filter: brightness(1);
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(229, 231, 235, 0.7);
}
.divider span {
  color: #9ca3af;
  font-size: 13px;
}
.btn-demo {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: 1.5px solid rgba(99, 102, 241, 0.25);
  color: #6366f1;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-demo:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
}

/* ===== 表单 ===== */
.form { display: flex; flex-direction: column; gap: 12px; }
.form input, .form select, .form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}
.form label { font-size: 13px; color: var(--text-light); display: flex; flex-direction: column; gap: 6px; }
.msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  background: var(--border);
  color: var(--text);
  transition: all .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 顶部导航 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand .logo { font-weight: 700; font-size: 16px; color: var(--primary); }
.nav-tabs { display: flex; gap: 4px; }
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-light);
}
.tab-btn.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; color: var(--text-light); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  display: inline-block;
}

/* ===== 主容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.panel { display: none; }
.panel.active { display: block; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2 { font-size: 18px; }

/* ===== 日历 ===== */
.week-nav { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.legend-item { font-size: 12px; padding: 3px 8px; border-radius: 4px; color: #fff; }
.legend-item.w10 { background: var(--w10); }
.legend-item.w9 { background: var(--w9); }
.legend-item.w8 { background: var(--w8); }
.legend-item.w4 { background: var(--w4); }
.legend-item.w2 { background: var(--w2); }
.legend-item.course { background: var(--course); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  background: var(--card);
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cal-day {
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
}
.cal-day.today { border-color: var(--primary); background: var(--primary-light); }
.cal-day-head { font-size: 12px; color: var(--text-light); font-weight: 600; }
.cal-day-head .date-num { font-size: 16px; color: var(--text); }
.cal-event {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cal-event.w10 { background: var(--w10); }
.cal-event.w9 { background: var(--w9); }
.cal-event.w8 { background: var(--w8); }
.cal-event.w4 { background: var(--w4); }
.cal-event.w2 { background: var(--w2); }
.cal-event.course { background: var(--course); }
.cal-event.completed { opacity: .5; text-decoration: line-through; }
.cal-event {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-check {
  width: 14px; height: 14px;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
}
.cal-check.done { background: #fff; color: var(--success); border-color: #fff; }
.cal-event-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===== 冲突提示 ===== */
.conflict-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}
.conflict-box h4 { color: var(--danger); margin-bottom: 8px; }
.plan-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
}
.plan-card h5 { color: var(--primary); margin-bottom: 4px; }
.plan-card .plan-desc { font-size: 12px; color: var(--text-light); }

/* ===== 任务列表 ===== */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  background: var(--card);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid var(--w2);
}
.task-item.w10 { border-left-color: var(--w10); }
.task-item.w9 { border-left-color: var(--w9); }
.task-item.w8 { border-left-color: var(--w8); }
.task-item.w4 { border-left-color: var(--w4); }
.task-item.w2 { border-left-color: var(--w2); }
.task-item.completed { opacity: .55; }
.task-item.completed .task-title { text-decoration: line-through; }
.task-check {
  width: 20px; height: 20px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; }
.task-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.task-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
}
.task-score { font-size: 12px; color: var(--text-light); }
.task-actions { display: flex; gap: 4px; }
.task-actions .btn-sm { padding: 3px 8px; font-size: 11px; }
.empty-tip { color: var(--text-light); text-align: center; padding: 40px; }

/* ===== 录入 ===== */
.input-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.input-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.input-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.input-mode { background: var(--card); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); }
.input-mode textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }
.tip { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.tip code { background: var(--primary-light); padding: 1px 6px; border-radius: 4px; color: var(--primary); }
.preview-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.preview-item {
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  border-left: 3px solid var(--primary);
}

/* ===== 复盘 ===== */
.review-content { background: var(--card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-light); }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin: 16px 0; }
.bar { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 4px; position: relative; }
.bar .bar-label { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--text-light); }
.suggestion-list { list-style: none; }
.suggestion-list li { padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.suggestion-list li:before { content: "💡 "; }
.review-section { margin-top: 16px; }
.review-section h4 { margin-bottom: 8px; color: var(--text); }

/* ===== 设置 ===== */
.settings-form { max-width: 500px; }
.notif-list { margin-top: 24px; }
.notif-list ul { list-style: none; }
.notif-list li {
  padding: 8px 12px;
  background: var(--card);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.notif-list li.warning { border-left: 3px solid var(--warning); }

.debug-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.debug-section h3 { font-size: 14px; color: var(--text-light); margin-bottom: 10px; }
.debug-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-card {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  width: 420px;
  max-width: 90vw;
}
.modal-card h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ===== Toast / Loading ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 200;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-tabs { flex-wrap: wrap; }
  .calendar-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: auto; }
  .container { padding: 12px; }

  /* 登录页移动端适配 */
  #login-view {
    padding: 20px;
  }
  .login-card {
    width: 100%;
    padding: 40px 28px;
    border-radius: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .login-logo {
    width: 46px;
    height: 46px;
    margin-bottom: 18px;
  }
  .login-card h1 {
    font-size: 22px;
  }
  .subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }
  .feature-tags {
    margin-bottom: 28px;
    gap: 6px;
  }
  .feature-tag {
    font-size: 11px;
    padding: 4px 10px;
  }
  .login-form {
    gap: 12px;
  }
  .login-form input {
    padding: 11px 14px;
    font-size: 14px;
  }
  .btn-login {
    padding: 12px 20px;
    font-size: 15px;
  }
  .btn-demo {
    padding: 11px 20px;
    font-size: 14px;
  }
  .login-bg-decoration {
    background-size: 24px 24px;
  }
}

@media (max-width: 480px) {
  #login-view {
    padding: 16px;
  }
  .login-card {
    padding: 32px 22px;
    border-radius: 16px;
  }
  .login-card h1 {
    font-size: 20px;
  }
  .feature-tags {
    margin-bottom: 24px;
  }
}
