#elective-page {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.elective-content {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================
   搜索框（修复）
   ============================================ */
.search-input-wrapper {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.search-input-wrapper > i:first-child {
  font-size: 16px;
  color: var(--subtext);
  opacity: 0.6;
  flex-shrink: 0;
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  min-width: 0;
}

.search-input-wrapper input::placeholder {
  color: var(--subtext);
  opacity: 0.6;
}

.elective-search-bar {
  position: relative;
}

.elective-search-bar .clear-btn {
  background: none;
  border: none;
  color: var(--subtext);
  cursor: pointer;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.elective-search-bar .clear-btn:hover {
  opacity: 1;
  color: var(--text);
}

/* 分类筛选栏 */
.elective-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-bottom: 4px;
  padding-bottom: 4px;
  width: 100%;
}

.elective-filter-bar::-webkit-scrollbar {
  display: none;
}

.elective-filter-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--glass);
  border-radius: 16px;
  font-size: 13px;
  color: var(--subtext);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.elective-filter-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  font-weight: 600;
}

.elective-filter-btn:active {
  transform: scale(0.95);
}

/* 课程列表 */
.elective-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 40px;
}

.elective-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.elective-card:active {
  transform: scale(0.98);
}

.elective-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.elective-card-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.elective-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.elective-card-id {
  font-size: 12px;
  color: var(--subtext);
  opacity: 0.7;
}

.elective-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.elective-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.elective-tag.category {
  background: var(--text-light);
  color: var(--text);
}

.elective-tag.mooc {
  background: rgba(255, 107, 53, 0.12);
  color: #ff6b35;
}

.elective-platform {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.elective-platform.chaoxing {
  background: rgba(255, 152, 0, 0.12);
  color: #ff9800;
}

.elective-platform.zhihuishu {
  background: rgba(76, 175, 80, 0.12);
  color: #4caf50;
}

.elective-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.elective-info-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.elective-info-item {
  font-size: 13px;
  color: var(--subtext);
  display: flex;
  align-items: center;
  gap: 4px;
}

.elective-info-item i {
  font-size: 12px;
  color: var(--text);
  opacity: 0.6;
}

.elective-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--subtext);
}

.elective-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.elective-empty p {
  font-size: 15px;
  margin: 0;
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
  .elective-tag.mooc {
    background: rgba(255, 138, 101, 0.15);
    color: #ff8a65;
  }
  .elective-platform.chaoxing {
    background: rgba(255, 183, 77, 0.15);
    color: #ffb74d;
  }
  .elective-platform.zhihuishu {
    background: rgba(129, 199, 132, 0.15);
    color: #81c784;
  }
}
