/* ===== 橙子部落 · 课程表样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Nunito', 'ZCOOL XiaoWei', -apple-system, sans-serif;
  background: #f7f3ee;
  min-height: 100vh;
  color: #5a4d42;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.page {
  min-height: 100vh;
  padding: 32px 20px 60px;
  max-width: 1080px;
  margin: 0 auto;
}
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a09080;
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 20px;
  transition: color 0.3s ease;
}
.nav-back:hover { color: #d4824a; }

/* ── Tabs ── */
.tabs {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.tab {
  padding: 8px 22px;
  border: 1px solid #e3d9cc;
  border-radius: 20px;
  background: #fffdf9;
  color: #8a7a6a;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
}
.tab:hover { border-color: #7dd48a; color: #5a9c64; }
.tab.active {
  background: rgba(125, 212, 138, 0.18);
  border-color: #7dd48a;
  color: #4d8f58;
  font-weight: 600;
}

/* ── 通用视图容器 ── */
.view { animation: fadeIn 0.25s ease; }
.view.hidden { display: none; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 周导航 ── */
.week-nav, .month-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 14px;
}
.week-btn {
  width: 34px; height: 34px;
  border: 1px solid #e3d9cc; border-radius: 50%;
  background: #fffdf9; color: #8a7a6a;
  font-size: 1rem; cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}
.week-btn:hover { border-color: #7dd48a; color: #4d8f58; }
.week-label {
  min-width: 140px; text-align: center;
  font-size: 0.95rem; color: #5a4d42; font-weight: 600;
}
.today-btn { width: auto; padding: 0 16px; border-radius: 17px; font-size: 0.85rem; }

/* ── 周视图网格 ── */
.schedule-wrap { overflow-x: auto; }
.schedule-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  min-width: 860px;
  background: #fffdf9;
  border-radius: 16px;
  border: 1px solid #efe6da;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(160, 140, 110, 0.08);
  position: relative;
}
.time-col, .day-col { min-height: 720px; position: relative; }
.time-col { border-right: 1px solid #f3ece2; background: #fbf7f1; }
.day-col { border-right: 1px solid #f3ece2; }
.day-col:last-child { border-right: none; }
.day-head {
  position: sticky; top: 0; z-index: 3;
  text-align: center; padding: 8px 4px;
  font-size: 0.78rem; color: #8a7a6a;
  background: rgba(255, 253, 249, 0.96);
  border-bottom: 1px solid #f3ece2;
}
.day-head .d-num { display: block; font-size: 1rem; font-weight: 700; color: #5a4d42; }
.day-head.today .d-num {
  color: #fff; background: #7dd48a;
  border-radius: 50%; width: 26px; height: 26px;
  line-height: 26px; margin: 0 auto;
}
.day-body { position: relative; height: 720px; }
.hour-line {
  position: absolute; left: 0; right: 0;
  border-top: 1px solid #f6f0e7;
}
.hour-label {
  position: absolute; left: 6px; transform: translateY(-50%);
  font-size: 0.68rem; color: #b5a795;
}
/* 课程色块 */
.course-block {
  position: absolute;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(120, 90, 50, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
  z-index: 2;
  min-height: 26px;
}
.course-block:hover { transform: scale(1.02); box-shadow: 0 4px 12px rgba(120, 90, 50, 0.25); z-index: 5; }
.course-block .cb-name { font-weight: 700; line-height: 1.3; word-break: break-all; }
.course-block .cb-time { font-size: 0.66rem; opacity: 0.92; margin-top: 2px; }
.course-block.conflict {
  border: 2px solid #e8874a;
  outline: 2px solid rgba(232, 135, 74, 0.35);
  animation: conflictPulse 1.6s ease-in-out infinite;
}
.course-block.leave-block {
  opacity: 0.55;
  border: 2px dashed #b5a795;
  background: #d8d0c5 !important;
}
.course-block.attended-block { opacity: 0.75; }
@keyframes conflictPulse {
  0%, 100% { outline-color: rgba(232, 135, 74, 0.35); }
  50% { outline-color: rgba(232, 135, 74, 0.7); }
}
.course-block .cb-status {
  position: absolute; top: 3px; right: 4px;
  font-size: 0.6rem;
  background: rgba(255,255,255,0.35);
  border-radius: 8px; padding: 0 5px;
}
.loading, .empty-tip {
  text-align: center; color: #b5a795;
  padding: 40px 0; font-size: 0.9rem;
  grid-column: 1 / -1;
}

/* ── 月视图 ── */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: #fffdf9;
  border-radius: 16px;
  border: 1px solid #efe6da;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(160, 140, 110, 0.08);
}
.month-head {
  text-align: center; font-size: 0.78rem; color: #8a7a6a;
  padding: 4px 0; font-weight: 600;
}
.month-cell {
  min-height: 78px;
  background: #fbf7f1;
  border-radius: 10px;
  padding: 5px 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  border: 1px solid transparent;
  position: relative;
}
.month-cell:hover { background: #f4ecdf; }
.month-cell.other-month { opacity: 0.35; }
.month-cell.today-cell { border-color: #7dd48a; }
.month-cell .m-date {
  font-size: 0.75rem; color: #8a7a6a;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
}
.month-cell.today-cell .m-date { background: #7dd48a; color: #fff; font-weight: 700; }
.month-cell .m-courses { margin-top: 3px; display: flex; flex-direction: column; gap: 2px; }
.m-cell-course {
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-cell-more { font-size: 0.62rem; color: #b5a795; padding-left: 4px; }
/* PC 端不显示小圆点（手机端才显示） */
.m-cell-dot { display: none; }

/* ── 数据统计 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.stat-card {
  background: #fffdf9;
  border-radius: 14px;
  border: 1px solid #efe6da;
  padding: 18px 14px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(160, 140, 110, 0.06);
}
.stat-num { font-size: 1.4rem; font-weight: 700; color: #4d8f58; }
.stat-label { font-size: 0.78rem; color: #8a7a6a; margin-top: 4px; }
.stats-section {
  background: #fffdf9;
  border-radius: 14px;
  border: 1px solid #efe6da;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(160, 140, 110, 0.06);
}
.stats-title { font-size: 0.9rem; color: #5a4d42; margin-bottom: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { min-width: 64px; font-size: 0.78rem; color: #8a7a6a; }
.bar-track { flex: 1; height: 12px; background: #f3ece2; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }
.bar-val { min-width: 40px; text-align: right; font-size: 0.75rem; color: #5a4d42; }

/* ── 课程列表 ── */
.course-list-wrap { margin-top: 26px; }
.course-list-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.course-list-header h3 { font-size: 1rem; color: #5a4d42; }
.add-btn {
  padding: 8px 18px;
  border: none; border-radius: 18px;
  background: #7dd48a; color: #fff;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  box-shadow: 0 2px 8px rgba(125, 212, 138, 0.4);
  transition: all 0.25s ease;
}
.add-btn:hover { background: #6cc47a; transform: translateY(-1px); }
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.course-item {
  background: #fffdf9;
  border-radius: 14px;
  border: 1px solid #efe6da;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 10px rgba(160, 140, 110, 0.06);
  transition: all 0.25s ease;
  cursor: pointer;
}
.course-item:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(160, 140, 110, 0.12); }
.course-item .c-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.course-item .c-info { flex: 1; min-width: 0; }
.course-item .c-name { font-weight: 600; font-size: 0.92rem; color: #5a4d42; }
.course-item .c-meta { font-size: 0.72rem; color: #b5a795; margin-top: 2px; }
.course-item .c-hours {
  text-align: right; flex-shrink: 0;
}
.course-item .c-remain {
  font-size: 1.1rem; font-weight: 700; color: #4d8f58;
}
.course-item .c-remain.low { color: #e8874a; }
.course-item .c-total { font-size: 0.68rem; color: #b5a795; }
.course-item.paused-item { opacity: 0.6; }
.course-item.paused-item .c-name::after { content: ' ⏸'; font-size: 0.7em; }
.course-item .c-actions { display: flex; gap: 4px; flex-direction: column; }
.mini-btn {
  border: 1px solid #e3d9cc; background: #fffdf9;
  border-radius: 8px; padding: 3px 8px;
  font-size: 0.68rem; color: #8a7a6a; cursor: pointer;
  transition: all 0.2s ease; font-family: inherit;
}
.mini-btn:hover { border-color: #7dd48a; color: #4d8f58; }
.mini-btn.danger:hover { border-color: #e8874a; color: #d4733a; }

/* ── 弹窗 ── */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(90, 77, 66, 0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-mask.hidden { display: none; }
.modal {
  background: #fffdf9;
  border-radius: 18px;
  max-width: 440px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(90, 77, 66, 0.2);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: #5a4d42; margin-bottom: 18px; text-align: center; }
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block; font-size: 0.78rem; color: #8a7a6a; margin-bottom: 6px;
}
.form-row input, .form-row select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e3d9cc;
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
  color: #5a4d42;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.form-row input:focus, .form-row select:focus { border-color: #7dd48a; }
.form-inline { display: flex; gap: 12px; }
.form-inline > div { flex: 1; }
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-btn {
  width: 38px; height: 38px;
  border: 1px solid #e3d9cc; border-radius: 50%;
  background: #fff; color: #8a7a6a;
  font-size: 0.9rem; cursor: pointer;
  transition: all 0.2s ease; font-family: inherit;
}
.day-btn:hover { border-color: #7dd48a; }
.day-btn.active {
  background: #7dd48a; border-color: #7dd48a; color: #fff; font-weight: 700;
}
.conflict-tip {
  background: rgba(232, 135, 74, 0.12);
  border: 1px solid #e8874a;
  color: #d4733a;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}
.conflict-tip.hidden { display: none; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px;
}
.btn-cancel, .btn-save {
  padding: 9px 24px;
  border-radius: 18px;
  font-size: 0.88rem;
  cursor: pointer; font-family: inherit;
  transition: all 0.2s ease;
}
.btn-cancel {
  background: #f3ece2; border: none; color: #8a7a6a;
}
.btn-save {
  background: #7dd48a; border: none; color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(125, 212, 138, 0.4);
}
.btn-save:hover { background: #6cc47a; }
.btn-cancel:hover { background: #eadfce; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: rgba(90, 77, 66, 0.92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(90, 77, 66, 0.3);
  animation: fadeIn 0.25s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.hidden { display: none; }

/* ── 页脚 ── */
.footer {
  text-align: center; color: #c4b6a6;
  font-size: 0.8rem; margin-top: 40px;
}

/* ── 响应式 ── */
/* 手机端周视图：纵向日卡片（由 JS isMobile() 切换 schedule-grid-mobile 类） */
.schedule-grid-mobile {
  display: block;
  background: none;
  border: none;
  box-shadow: none;
  min-width: auto;
}
.day-card {
  background: #fffdf9;
  border-radius: 14px;
  border: 1px solid #efe6da;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(160, 140, 110, 0.06);
}
.day-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #5a4d42;
}
.day-card-head .d-date {
  font-weight: 400;
  color: #8a7a6a;
  font-size: 0.8rem;
}
.course-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.course-mini:active { transform: scale(0.98); }
.course-mini .cm-time {
  opacity: 0.92;
  font-size: 0.72rem;
  margin-left: 8px;
  white-space: nowrap;
}
.course-mini.conflict {
  outline: 2px solid rgba(232, 135, 74, 0.6);
  border: 1px solid #e8874a;
}
.day-card.today-card {
  border-color: #7dd48a;
  box-shadow: 0 2px 10px rgba(125, 212, 138, 0.25);
}
.day-empty {
  color: #c4b6a6;
  font-size: 0.78rem;
  padding: 2px 0;
}

@media (max-width: 767px) {
  .page { padding: 24px 12px 48px; }
  .tab { padding: 7px 16px; font-size: 0.82rem; }
  /* 周视图不再强制最小宽度，由移动端 JS 重绘纵向列表控制 */
  .course-list { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-num { font-size: 1.1rem; }
  .modal { padding: 20px 16px; }
  .day-btn { width: 34px; height: 34px; }

  /* ── 手机端月视图：课程只显示彩色圆点 ── */
  .month-grid { padding: 8px; gap: 4px; }
  .month-cell { min-height: 52px; padding: 3px 4px; }
  .month-cell .m-date { width: 22px; height: 22px; font-size: 0.72rem; }
  .month-cell .m-courses {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
    margin-top: 2px;
  }
  .m-cell-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
  }
  .m-cell-course { display: none; }  /* 手机端不显示课程文字，只看圆点 */
  .m-cell-more { font-size: 0.58rem; padding-left: 2px; }
}
