/* 主题切换CSS变量 */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96%;
  --secondary-foreground: 222.2 84% 4.9%;
  --muted: 210 40% 96%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96%;
  --accent-foreground: 222.2 84% 4.9%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 212.7 26.8% 83.9%;
}

/* 主题相关的背景和文本颜色 */
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 卡片样式 */
.theme-card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
}

/* 导航栏样式 */
.theme-nav {
  background-color: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
}

/* 主题切换按钮样式 */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background-color: hsl(var(--accent));
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: all 0.2s ease;
}

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

.theme-toggle .moon-icon {
  transform: rotate(90deg) scale(0);
}

.dark .theme-toggle .sun-icon {
  transform: rotate(90deg) scale(0);
}

.dark .theme-toggle .moon-icon {
  transform: rotate(0deg) scale(1);
}

/* 下拉菜单样式 */
.theme-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 120px;
  background-color: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 50;
}

.theme-toggle:hover .theme-dropdown,
.theme-dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-dropdown-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: hsl(var(--popover-foreground));
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.theme-dropdown-item:hover {
  background-color: hsl(var(--accent));
}

.theme-dropdown-item:first-child {
  border-radius: 6px 6px 0 0;
}

.theme-dropdown-item:last-child {
  border-radius: 0 0 6px 6px;
}

.theme-dropdown-item svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
  
  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }
}