:root {
  /* 背景色 - 苹果风深色 */
  --bg-primary: #1c1c1e;
  --bg-secondary: #2c2c2e;
  --bg-tertiary: #3a3a3c;
  --bg-quaternary: #48484a;
  --titlebar-bg: #262628;

  /* 强调色 - 苹果系统色板 */
  --accent-blue: #0a84ff;
  --accent-purple: #bf5af2;
  --accent-green: #30d158;
  --accent-orange: #ff9f0a;
  --accent-red: #ff453a;
  --accent-cyan: #64d2ff;
  --accent-pink: #ff375f;

  /* 兼容旧变量名 */
  --accent-primary: var(--accent-blue);
  --accent-secondary: var(--accent-purple);
  --accent-success: var(--accent-green);
  --accent-warning: var(--accent-orange);
  --accent-danger: var(--accent-red);

  /* 文字色 */
  --text-primary: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.3);
  --text-muted: var(--text-tertiary);

  /* 边框/分隔 */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --separator: rgba(255, 255, 255, 0.06);

  /* 字体 - SF 风格 */
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* 尺寸 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* 浅色主题变量 */
.light-theme {
  /* 背景色 - 苹果风浅色 */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e5e5ea;
  --bg-quaternary: #d1d1d6;
  --titlebar-bg: #f5f5f7;

  /* 文字色 */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-muted: var(--text-tertiary);

  /* 边框/分隔 */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --separator: rgba(0, 0, 0, 0.06);
}

/* 浅色主题滚动条样式 */
.light-theme ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

.light-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  user-select: none;
  -webkit-user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===== 标题栏 ===== */
.title-bar {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
}

.traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: no-drag;
  width: 68px;
  padding-left: 10px;
  padding-right: 6px;
  position: relative;
  z-index: 10;
  height: 100%;
  flex-shrink: 0;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0.5px solid rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  position: relative;
  -webkit-app-region: no-drag;
  flex-shrink: 0;
  background: transparent;
}

.traffic-light:hover {
  cursor: pointer;
}

.traffic-light.close {
  background-color: #ff5f57;
}
.traffic-light.minimize {
  background-color: #febc2e;
}
.traffic-light.zoom {
  background-color: #28c840;
}

/* 玻璃球高光与阴影 */
.traffic-light::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 8px 4px at 50% 15%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 70%),
    radial-gradient(ellipse 10px 4px at 50% 95%, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0) 60%);
  pointer-events: none;
  z-index: 1;
}

/* 图标 - 用 SVG data URI 绘制 */
.traffic-light .tl-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  display: block;
}

/* 鼠标进入按钮组，图标立即显示 */
.traffic-lights:hover .traffic-light .tl-icon {
  opacity: 1;
}

.tl-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}


.title-bar-drag {
  -webkit-app-region: drag;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  min-width: 0;
}

.title-bar-drag .app-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.title-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 76px;
  padding-left: 8px;
  -webkit-app-region: no-drag;
}

.server-info {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== 按钮通用 - 苹果风格 ===== */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: linear-gradient(180deg, #409cff 0%, #0a84ff 100%);
  color: white;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  filter: brightness(0.92);
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-ghost {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 0.5px solid var(--border-strong);
}

.btn-ghost:hover {
  background: var(--bg-quaternary);
}

.btn-ghost:active {
  filter: brightness(0.9);
}

.btn-back {
  padding: 6px 10px;
  color: var(--accent-blue);
  border-radius: var(--radius-sm);
}

.btn-back:hover {
  background: rgba(10, 132, 255, 0.1);
}

.btn-text-danger {
  color: var(--accent-red);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  opacity: 0.9;
}

.btn-text-danger:hover {
  opacity: 1;
  background: rgba(255, 69, 58, 0.1);
}

/* ===== 面板通用 ===== */
.panel-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--border-color);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ===== 滚动条 - macOS 风格 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
  background-clip: padding-box;
  border: 2px solid transparent;
}

::-webkit-scrollbar-corner {
  background: transparent;
}
