/**
 * 主题切换器组件样式
 * Theme Switcher Component Styles
 */

/* 主题切换器容器 */
.theme-switcher {
  position: relative;
  display: inline-block;
}

/* 主题切换按钮 - 现代化简洁设计 */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--border-color, #e1e5e9);
  border-radius: 6px;
  background: var(--background-color, #ffffff);
  color: var(--text-secondary, #666);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.theme-toggle-btn:hover {
  background: var(--surface-color, #fff);
  color: var(--primary-color, #1890ff);
  border-color: var(--primary-color, #1890ff);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0);
  background: var(--surface-color, rgba(24, 144, 255, 0.15));
}

.theme-toggle-btn:focus {
  outline: 2px solid var(--primary-color, #1890ff);
  outline-offset: 2px;
}

/* 主题图标容器 */
.theme-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

/* 主题图标 */
.theme-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: scale(0.8) rotate(-180deg);
}

.theme-icon.active {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Emoji 图标样式 */
.theme-emoji {
  font-size: 20px;
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

/* 图标悬停效果 */
.theme-toggle-btn:hover .theme-emoji {
  transform: scale(1.1);
}

/* 图标激活时的轻微旋转效果 */
.theme-icon.active .theme-emoji {
  animation: iconBounce 0.5s ease-out;
}

@keyframes iconBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* 主题标签 - 默认隐藏，只显示图标 */
.theme-label {
  display: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 悬停效果 */
.theme-toggle-btn:hover .theme-icon {
  transform: scale(1.1) rotate(5deg);
}

.theme-toggle-btn:hover .theme-icon.active {
  transform: scale(1.1) rotate(5deg);
}

/* 主题下拉菜单 */
.theme-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface-color, #ffffff);
  border: 1px solid var(--border-color, #f0f0f0);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  min-width: 180px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.theme-switcher.show .theme-menu,
.theme-switcher:hover .theme-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 主题选项 */
.theme-option {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-primary, #262626);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.theme-option:hover {
  background: var(--primary-color, #1890ff);
  color: #ffffff;
}

.theme-option:focus {
  background: var(--primary-color, #1890ff);
  color: #ffffff;
  outline: none;
}

/* 主题选项图标 */
.theme-option .theme-icon {
  margin-right: 12px;
  font-size: 16px;
  width: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.theme-option:hover .theme-icon {
  transform: scale(1.1);
}

/* 主题选项名称 */
.theme-option .theme-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

/* 主题选项描述 */
.theme-option .theme-description {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

/* 主题选中标记 */
.theme-option .theme-check {
  margin-left: 8px;
  font-size: 14px;
  color: var(--success-color, #52c41a);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.theme-option .theme-check.active {
  opacity: 1;
}

.theme-option:hover .theme-check {
  color: #ffffff;
}

/* 主题切换动画效果 */
.theme-switching {
  position: relative;
}

.theme-switching::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
  z-index: 9999;
  opacity: 0;
  animation: themeSwitch 0.3s ease;
  pointer-events: none;
}

@keyframes themeSwitch {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .theme-toggle-btn {
    min-width: 36px;
    height: 36px;
    padding: 6px 10px;
    font-size: 14px;
  }
  
  .theme-label {
    font-size: 12px;
  }
  
  .theme-svg-icon {
    width: 14px;
    height: 14px;
  }
  
  .theme-menu {
    right: -8px;
    min-width: 160px;
  }
  
  .theme-option {
    padding: 10px 14px;
  }
  
  .theme-option .theme-name {
    font-size: 13px;
  }
  
  .theme-option .theme-description {
    font-size: 11px;
  }
}

/* 小屏移动端 - 只显示图标 */
@media (max-width: 480px) {
  .theme-toggle-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px;
    gap: 0;
  }
  
  .theme-label {
    display: none;
  }
  
  .theme-icon-wrapper {
    width: 18px;
    height: 18px;
  }
  
  .theme-svg-icon {
    width: 16px;
    height: 16px;
  }
  
  .theme-menu {
    position: fixed;
    top: auto;
    bottom: 60px;
    right: 16px;
    left: 16px;
    width: auto;
    min-width: auto;
    border-radius: 16px;
  }
  
  .theme-option {
    padding: 14px 16px;
    font-size: 16px;
  }
  
  .theme-option .theme-icon {
    font-size: 18px;
    margin-right: 16px;
  }
  
  .theme-option .theme-name {
    font-size: 16px;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .theme-toggle-btn {
    border: 2px solid var(--text-primary, #000000);
  }
  
  .theme-menu {
    border: 2px solid var(--text-primary, #000000);
  }
  
  .theme-option {
    border-bottom: 1px solid var(--border-color, #000000);
  }
  
  .theme-option:last-child {
    border-bottom: none;
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle-btn,
  .theme-menu,
  .theme-option,
  .theme-icon,
  .theme-check {
    transition: none !important;
  }
  
  .theme-switching::before {
    animation: none !important;
  }
}

/* 深色模式特殊样式 */
@media (prefers-color-scheme: dark) {
  .theme-toggle-btn {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .theme-toggle-btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  }
  
  .theme-menu {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* 键盘导航支持 */
.theme-option:focus-visible {
  background: var(--primary-color, #1890ff);
  color: #ffffff;
  outline: 2px solid var(--primary-color, #1890ff);
  outline-offset: -2px;
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .theme-toggle-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .theme-option {
    min-height: 44px;
    padding: 12px 16px;
  }
}

/* 打印样式 */
@media print {
  .theme-switcher {
    display: none !important;
  }
}
