/* ============================================
   Settings Page Styles - 设置页面样式 - 滚动修复版
   ============================================ */

/* ========== 最优先：确保滚动正常 ========== */
.main-content:has(.settings-container) {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: calc(100vh - 49px) !important;
  display: block !important;
  flex-direction: initial !important;
}

.main-content:has(.settings-container) > * {
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
}

/* ========== 设置容器 ========== */
.settings-container {
  padding: 32px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-sizing: border-box;
  overflow: visible !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  flex: none !important;
  padding-bottom: 40px;
}

.settings-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.settings-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 24px 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border-light);
}

/* ========== 设置分区 ========== */
.settings-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--color-border-light);
}

.settings-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 16px 0;
}

/* ========== 设置项 ========== */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.setting-item:first-child {
  padding-top: 0;
}

.setting-item:last-child {
  padding-bottom: 0;
}

.setting-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.setting-description {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ========== 单选按钮组 ========== */
.radio-group {
  display: flex;
  gap: 16px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 10px 16px;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.radio-item:hover {
  border-color: var(--color-primary-alpha-20);
  background: var(--color-primary-alpha-10);
  color: var(--color-primary);
}

.radio-item input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.radio-item:has(input[type="radio"]:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-alpha-10);
  color: var(--color-primary);
  font-weight: 600;
}

/* ========== 开关组件 ========== */
.switch-wrapper {
  position: relative;
  width: 44px;
  height: 24px;
}

.switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.switch-input:checked + .switch-slider {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch-input:focus + .switch-slider {
  box-shadow: 0 0 0 3px var(--color-primary-alpha-20);
}

/* ========== 选择框 ========== */
.setting-select {
  padding: 8px 14px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 120px;
}

.setting-select:hover {
  border-color: var(--color-primary);
}

.setting-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-alpha-10);
}

/* ========== 设置按钮组 ========== */
.settings-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

/* ========== 主题预览卡片 ========== */
.theme-preview-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.theme-preview-card {
  flex: 1;
  padding: 16px;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.theme-preview-card:hover {
  border-color: var(--color-primary-alpha-20);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-preview-card.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-alpha-10);
}

.theme-preview-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.theme-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ========== 响应式调整 ========== */
@media (max-width: 640px) {
  .settings-container {
    padding: 16px;
  }

  .settings-card {
    padding: 20px;
  }

  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .radio-group {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .radio-item {
    width: 100%;
  }
}
