/* 课表页 */
#schedule-page {
  display: flex;
  flex-direction: column;
  overflow-y: hidden !important;
}

#schedule-page .sub-page-header {
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

#schedule-page .schedule-page-content {
  max-width: 100%;
  padding: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

#schedule-page .course-section {
  max-width: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#schedule-page #courseManageSection {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 标题栏：完全透明 */
.schedule-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px !important;
  justify-content: space-between !important;
}

.schedule-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.schedule-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  padding: 0;
}

.schedule-header-btn:active {
  transform: scale(0.9);
}

.schedule-header-btn.danger {
  border-color: #ff4757;
  color: #ff4757;
}

/* 课表滑动容器：JS 控制，禁用原生惯性滚动 */
.schedule-slider {
  display: flex;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

.schedule-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* 课表表格：表头与侧边栏完全透明 */
.schedule-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 11px;
  margin: 0;
}

.schedule-table th {
  position: sticky;
  top: 0;
  z-index: 30;
  background: transparent !important;
}

.schedule-table th:first-child {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding: 8px 2px;
  text-align: center;
  vertical-align: middle;
  z-index: 40;
  left: 0;
}

.schedule-table td:first-child {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding: 4px 1px;
  text-align: center;
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 20;
  background: transparent !important;
}

.schedule-table th:not(:first-child),
.schedule-table td:not(:first-child) {
  width: calc((100% - 40px) / 7) !important;
  padding: 0;
  border-right: 1px solid rgba(0,0,0,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.schedule-table th:not(:first-child) {
  padding: 6px 2px;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
}

.schedule-table tbody tr {
  height: 60px !important;
  max-height: 60px;
}

.schedule-table tbody td {
  height: 60px !important;
  max-height: 60px;
  box-sizing: border-box;
}

.schedule-table td[rowspan="12"] {
  height: 720px !important;
  max-height: 720px;
  vertical-align: top;
  position: relative;
}

.schedule-table th:last-child,
.schedule-table td:last-child {
  border-right: 1px solid rgba(0,0,0,0.08) !important;
}

/* 右下角悬浮周次切换按钮 */
.schedule-float-nav {
  position: fixed;
  bottom: 10px;
  right: 16px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  z-index: 60;
  pointer-events: none;
}

#schedule-page:not(.active) .schedule-float-nav {
  display: none;
}

.schedule-float-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  pointer-events: auto;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  padding: 0;
}

.schedule-float-btn:active {
  transform: scale(0.92);
}

/* 课程导入按钮 */
.course-import-btn-wide {
  width: 100%;
  padding: 16px 24px;
  border: 1px solid var(--text);
  border-radius: 12px;
  background: var(--text-light);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.course-import-btn-wide:hover {
  background: var(--text);
  color: #fff;
}

.course-import-btn-wide:active {
  transform: scale(0.98);
}

/* 课程块样式 */
.course-cell-overlay {
  position: absolute;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 4px;
  box-sizing: border-box;
  overflow: visible;
  cursor: pointer;
  font-size: 10px;
  color: #000;
  border: 1px solid rgba(0,0,0,0.1);
  backdrop-filter: blur(2px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.2;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.course-cell-overlay:active {
  transform: scale(0.92);
  transition: transform 0.08s ease;
}

.course-cell-overlay .course-name {
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
  text-align: left;
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-bottom: 2px;
}

.course-cell-overlay .course-room {
  font-size: 9px;
  opacity: 0.85;
  text-align: left;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-bottom: 1px;
}

.course-cell-overlay .course-teacher {
  font-size: 8px;
  opacity: 0.7;
  text-align: left;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-top: auto;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
  .schedule-table th,
  .schedule-table td:first-child {
    background: transparent !important;
  }
  
  .schedule-table td:not(:has(.course-cell)):not(:first-child) {
    background: rgba(255, 255, 255, 0.03);
  }
  
  .course-cell-overlay {
    color: #fff;
    border-color: rgba(255,255,255,0.15);
  }
  
  .course-cell-overlay .course-name,
  .course-cell-overlay .course-room,
  .course-cell-overlay .course-teacher {
    color: rgba(255,255,255,0.95);
  }
}

/* 课表分享全屏页 */
#shareScheduleOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#shareScheduleOverlay::-webkit-scrollbar {
  display: none;
}

#shareScheduleOverlay.active {
  display: flex;
}

.share-back-btn {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1001;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  padding: 0;
}

.share-back-btn:active {
  transform: scale(0.95);
}

.share-scroll-content {
  width: 100%;
  max-width: 420px;
  padding: 44px 14px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.share-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.share-title-row {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
  line-height: 1.3;
}

.share-title-input {
  display: inline-block;
  min-width: 32px;
  max-width: 160px;
  border-bottom: 2px solid var(--text);
  padding: 0 2px 1px;
  outline: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.2;
  transition: border-color 0.2s;
}

.share-title-input:focus {
  border-bottom-color: var(--color-blue);
}

.share-title-suffix {
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.share-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0 2px;
  margin-bottom: 2px;
}

.share-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.share-weeks-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.share-weeks-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.share-week-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.share-week-cells {
  position: relative;
  width: 100%;
  padding-bottom: 155%;
  background: rgba(128,128,128,0.05);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

.share-week-cell {
  position: absolute;
  border-radius: 1px;
  opacity: 0.95;
  transform: scale(0.88);
  transform-origin: center;
}

.share-week-label {
  font-size: 9px;
  color: var(--subtext);
  font-weight: 500;
  line-height: 1.1;
}

.share-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  width: 100%;
}

.share-footer-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--glass);
}

.share-footer-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.share-footer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.share-footer-link {
  font-size: 10px;
  color: var(--subtext);
  opacity: 0.7;
  line-height: 1.3;
  word-break: break-all;
}

@media (prefers-color-scheme: dark) {
  #shareScheduleOverlay {
    background: rgba(30, 30, 30, 0.7);
  }
  
  .share-title-input {
    border-bottom-color: var(--text);
  }
  
  .share-week-cells {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.06);
  }
}

/* ============================================
   8. 课表弹窗与课程表
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--glass);
  backdrop-filter: blur(8px);
  z-index: 10001;
  display: none;
}

.course-section {
  width: 100%;
  max-width: 400px;
  margin-bottom: 16px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.course-import-btn-wide {
  width: 100%;
  padding: 16px 24px;
  border: 1px solid var(--text);
  border-radius: 12px;
  background: var(--text-light);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.course-import-btn-wide:hover {
  background: var(--text);
  color: #fff;
}

.course-import-btn-wide:active {
  transform: scale(0.98);
}

.course-schedule-home {
  width: 100%;
  max-width: 480px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  touch-action: pan-y;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.schedule-home-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--text-light);
  position: sticky;
  top: 0;
  z-index: 5;
}

.schedule-home-header button {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.schedule-home-header button:hover {
  background: var(--text);
  color: #fff;
}

.schedule-home-header span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
  text-align: center;
}

.schedule-home-table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1;
  min-height: 0;
}

#homeScheduleTable {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 11px;
  margin: 0;
}

#homeScheduleTable th:first-child,
#homeScheduleTable td:first-child {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding: 4px 1px;
  text-align: center;
  vertical-align: middle;
  background: rgba(128, 128, 128, 0.06);
  border-right: 1px solid rgba(0,0,0,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  position: sticky;
  left: 0;
  z-index: 20;
}

#homeScheduleTable th:not(:first-child),
#homeScheduleTable td:not(:first-child) {
  width: calc((100% - 40px) / 7) !important;
  padding: 0;
  border-right: 1px solid rgba(0,0,0,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

#homeScheduleTable th:not(:first-child) {
  padding: 6px 2px;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
}

#homeScheduleTable tbody tr {
  height: 60px !important;
  max-height: 60px;
}

#homeScheduleTable tbody td {
  height: 60px !important;
  max-height: 60px;
  box-sizing: border-box;
}

#homeScheduleTable td[rowspan="12"] {
  height: 720px !important;
  max-height: 720px;
  vertical-align: top;
  position: relative;
}

#homeScheduleTable th:last-child,
#homeScheduleTable td:last-child {
  border-right: 1px solid rgba(0,0,0,0.08) !important;
}

.day-course-container {
  position: relative;
  width: 100%;
  height: 720px;
  overflow: visible;
}

.course-cell-overlay {
  position: absolute;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 4px;
  box-sizing: border-box;
  overflow: visible;
  cursor: pointer;
  font-size: 10px;
  color: #000;
  border: 1px solid rgba(0,0,0,0.1);
  backdrop-filter: blur(2px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.2;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.course-cell-overlay:active {
  transform: scale(0.92);
  transition: transform 0.08s ease;
}

.course-cell-overlay .course-name {
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
  text-align: left;
  width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-bottom: 2px;
}

.course-cell-overlay .course-room {
  font-size: 9px;
  opacity: 0.85;
  text-align: left;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-bottom: 1px;
}

.course-cell-overlay .course-teacher {
  font-size: 8px;
  opacity: 0.7;
  text-align: left;
  width: 100%;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  margin-top: auto;
}

.course-action-btns-wide {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.course-action-btn {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--text);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.course-action-btn:hover {
  background: var(--text-light);
}

.course-action-btn:active {
  transform: scale(0.98);
}

.course-action-btn.danger {
  border-color: #ff4757;
  color: #ff4757;
}

.course-action-btn.danger:hover {
  background: rgba(255, 71, 87, 0.1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--glass);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: modalSlideUp 0.3s ease;
}

.modal-card.wide { max-width: 400px; }
.modal-card.scrollable { max-height: 85vh; overflow-y: auto; }
.modal-card.small { max-width: 320px; width: 90%; }

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

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

.modal-header span {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--subtext);
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(128, 128, 128, 0.1);
}

.modal-desc {
  font-size: 14px;
  color: var(--subtext);
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.modal-btn.primary {
  background: var(--text);
  color: #fff;
}

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

.modal-btn:active {
  transform: scale(0.98);
}

.reminder-cancel-btn {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid #ff4757;
  color: #ff4757;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.reminder-cancel-btn:hover {
  background: rgba(255, 71, 87, 0.25);
  transform: scale(1.05);
}

.reminder-countdown {
  font-size: 20px;
  font-weight: 700;
  color: #ff6b35;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.schedule-page-content,
.contribution-page-content {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 120px;
  animation: fadeInUp 0.3s ease;
}

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