/* 主题变量定义 */
:root {
  /* 默认dark模式 */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-card: #1e2a3a;
  --bg-input: #2d3748;
  --text-primary: #f0f0f0;
  --text-secondary: #c0c0c0;
  --text-muted: #999999;
  --border-color: #2d3748;
  --border-light: #374151;
  --accent-color: #4299e1;
  --accent-hover: #3182ce;
  --success-color: #48bb78;
  --success-hover: #38a169;
  --warning-color: #ed8936;
  --warning-hover: #dd6b20;
  --danger-color: #fc8181;
  --danger-hover: #f56565;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
  --sidebar-bg: #0f172a;
  --sidebar-text: rgba(255, 255, 255, 0.65);
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --sidebar-active: rgba(255, 255, 255, 0.15);
  --topbar-bg: #0f172a;
  --topbar-text: rgba(255, 255, 255, 0.75);
  --table-header-bg: #1e2a3a;
  --table-row-hover: #2d3748;
  --tab-bg: #1e2a3a;
  --tab-active-bg: #2d3748;
  --tab-border: #374151;
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-muted: #888888;
  --border-color: #d9d9d9;
  --border-light: #e8e8e8;
  --accent-color: #1a73e8;
  --accent-hover: #1557b0;
  --success-color: #27ae60;
  --success-hover: #219a52;
  --warning-color: #e67e22;
  --warning-hover: #d35400;
  --danger-color: #e74c3c;
  --danger-hover: #c0392b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --sidebar-bg: #001529;
  --sidebar-text: rgba(255, 255, 255, 0.65);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --topbar-bg: #001529;
  --topbar-text: rgba(255, 255, 255, 0.75);
  --table-header-bg: #fafafa;
  --table-row-hover: #f8fbff;
  --tab-bg: #f8f9fa;
  --tab-active-bg: #ffffff;
  --tab-border: #dee2e6;
}

/* 跟随系统主题 */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-card: #1e2a3a;
    --bg-input: #2d3748;
    --text-primary: #f0f0f0;
    --text-secondary: #c0c0c0;
    --text-muted: #999999;
    --border-color: #2d3748;
    --border-light: #374151;
    --accent-color: #4299e1;
    --accent-hover: #3182ce;
    --success-color: #48bb78;
    --success-hover: #38a169;
    --warning-color: #ed8936;
    --warning-hover: #dd6b20;
    --danger-color: #fc8181;
    --danger-hover: #f56565;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --sidebar-bg: #0f172a;
    --sidebar-text: rgba(255, 255, 255, 0.65);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.15);
    --topbar-bg: #0f172a;
    --topbar-text: rgba(255, 255, 255, 0.75);
    --table-header-bg: #1e2a3a;
    --table-row-hover: #2d3748;
    --tab-bg: #1e2a3a;
    --tab-active-bg: #2d3748;
    --tab-border: #374151;
  }
}

@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafafa;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #d9d9d9;
    --border-light: #e8e8e8;
    --accent-color: #1a73e8;
    --accent-hover: #1557b0;
    --success-color: #27ae60;
    --success-hover: #219a52;
    --warning-color: #e67e22;
    --warning-hover: #d35400;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --sidebar-bg: #001529;
    --sidebar-text: rgba(255, 255, 255, 0.65);
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(255, 255, 255, 0.12);
    --topbar-bg: #001529;
    --topbar-text: rgba(255, 255, 255, 0.75);
    --table-header-bg: #fafafa;
    --table-row-hover: #f8fbff;
    --tab-bg: #f8f9fa;
    --tab-active-bg: #ffffff;
    --tab-border: #dee2e6;
  }
}

/* 主题切换器样式 */
.theme-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.theme-switcher-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  color: var(--topbar-text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.theme-switcher-toggle:hover {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

.theme-switcher-toggle .theme-icon {
  font-size: 16px;
}

.theme-switcher-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 160px;
  display: none;
}

.theme-switcher-dropdown.show {
  display: block;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.theme-option:hover {
  background: var(--bg-tertiary);
}

.theme-option:first-child {
  border-radius: 6px 6px 0 0;
}

.theme-option:last-child {
  border-radius: 0 0 6px 6px;
}

.theme-option.active {
  color: var(--accent-color);
  background: var(--bg-tertiary);
}

.theme-option .theme-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.theme-option .theme-label {
  flex: 1;
}

.theme-option .theme-check {
  color: var(--accent-color);
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.theme-option.active .theme-check {
  opacity: 1;
}

.version-info {
  font-size: small;
  margin-right: 10px;
  opacity: 0.7;
  color: var(--topbar-text);
}
