/* ========================================
   设置页面移动端优化样式 - 优化版本
   ======================================== */

/* 移动端菜单切换按钮 */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--settings-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--settings-shadow-lg);
  transition: var(--settings-transition);
}

.mobile-menu-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.2);
}

/* 遮罩层 */
.settings-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.settings-overlay.active {
  opacity: 1;
}

/* 增强的设置项响应式 */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .settings-overlay.active {
    display: block;
  }

  .settings-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    text-align: center;
  }

  .settings-header h1 {
    font-size: 1.5rem;
  }

  .section-header h2 {
    font-size: 1.25rem;
  }

  /* 优化开关控件 */
  .toggle-switch {
    transform: scale(0.9);
  }

  /* 优化滑块控件 */
  .font-size-control,
  .opacity-control {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .font-size-control input[type="range"],
  .opacity-control input[type="range"] {
    min-width: auto;
    width: 100%;
  }

  /* 主题按钮响应式 */
  .theme-switcher {
    flex-direction: column;
    gap: 0.25rem;
  }

  .theme-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
    text-align: left;
    min-width: auto;
    width: 100%;
  }

  .theme-btn i {
    margin-right: 0.5rem;
    margin-bottom: 0;
  }

  /* 背景类型选择器 */
  .bg-type-selector {
    flex-direction: column;
    gap: 0.25rem;
  }

  .bg-type-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
    min-width: auto;
    width: 100%;
  }

  .bg-type-btn i {
    margin-right: 0.5rem;
    margin-bottom: 0;
  }

  /* 颜色预设优化 */
  .color-presets {
    justify-content: center;
  }

  .color-preset {
    width: 40px;
    height: 40px;
  }

  /* 数据信息优化 */
  .data-info {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  /* 功能列表优化 */
  .feature-list {
    font-size: 0.9rem;
  }

  .feature-item {
    margin-bottom: 0.5rem;
  }

  /* 版本信息优化 */
  .version-info {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .settings-main {
    padding: 0.75rem;
  }

  .setting-item {
    padding: 1rem 0.75rem;
  }

  .settings-group {
    border-radius: var(--settings-radius);
  }

  .section-header {
    margin-bottom: 1.5rem;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  .setting-label h3 {
    font-size: 0.95rem;
  }

  .setting-label p {
    font-size: 0.85rem;
  }

  /* 按钮组优化 */
  .footer-actions {
    gap: 0.5rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    justify-content: center;
  }

  /* 自定义选择框 */
  .custom-select {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .settings-sidebar {
    width: 240px;
  }

  .settings-main {
    margin-left: 240px;
    max-width: calc(100% - 240px);
    padding: 1rem 1.5rem;
  }

  .mobile-menu-toggle {
    display: none;
  }

  .settings-overlay {
    display: none !important;
  }
}

/* 平板优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .settings-main {
    padding: 2rem;
  }

  .setting-item {
    padding: 1.25rem 1.5rem;
  }

  .setting-control {
    min-width: 180px;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .nav-item {
    padding: 1rem;
  }

  .nav-item:hover {
    transform: none;
  }

  .nav-item:active {
    transform: scale(0.98);
    background: var(--settings-primary);
    color: white;
  }

  .btn:hover {
    transform: none;
  }

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

  .theme-btn:hover,
  .bg-type-btn:hover {
    transform: none;
  }

  .theme-btn:active,
  .bg-type-btn:active {
    transform: scale(0.95);
  }

  .color-preset:hover {
    transform: none;
  }

  .color-preset:active {
    transform: scale(0.9);
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .settings-container {
    border: 2px solid var(--settings-text);
  }

  .settings-sidebar {
    border-right: 2px solid var(--settings-text);
  }

  .nav-item.active {
    border: 2px solid white;
  }

  .settings-group {
    border: 2px solid var(--settings-border);
  }

  .btn {
    border-width: 2px;
  }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .settings-section {
    animation: none;
  }
}
