/* ==========================================================================
 * main.css — 全局样式：CSS 变量、重置、布局、通用组件
 * ========================================================================== */

/* ---------- CSS 自定义属性（设计令牌） ---------- */
:root {
  /* 颜色体系 */
  --color-bg: #1a1a2e;
  --color-surface: #16213e;
  --color-surface-alt: #0f3460;
  --color-border: #2a2a4a;
  --color-border-active: #533483;
  --color-text: #e0e0e0;
  --color-text-muted: #8888aa;
  --color-accent: #7c3aed;
  --color-accent-hover: #8b5cf6;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-danger-hover: #f87171;
  --color-warning: #f59e0b;

  /* 尺寸 */
  --left-panel-width: 320px;
  --header-height: 52px;
  --footer-height: 32px;
  --radius: 8px;
  --radius-sm: 4px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ---------- 全局重置 ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 应用整体布局（flex 列） ---------- */
body {
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部标题栏 ---------- */
#app-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 10;
}
#app-header h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#app-header .subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- 主体双栏布局 ---------- */
#app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0; /* flex 子元素允许收缩 */
}

/* 左侧面板 */
#left-panel {
  width: var(--left-panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

/* 右侧面板 */
#right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  min-width: 0;
}

/* ---------- 底部状态栏 ---------- */
#app-footer {
  height: var(--footer-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ---------- 通用按钮样式 ---------- */
button {
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  transition: background var(--transition-fast), color var(--transition-fast),
              transform var(--transition-fast);
}
button:active {
  transform: scale(0.96);
}

/* ---------- 通用输入样式 ---------- */
input[type="number"],
input[type="text"] {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  width: 60px;
  text-align: center;
  transition: border-color var(--transition-fast);
}
input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--color-accent);
}
input[type="text"] {
  width: 180px;
  text-align: left;
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---------- 响应式：窄屏时上下布局 ---------- */
@media (max-width: 768px) {
  #app-main {
    flex-direction: column;
  }
  #left-panel {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  #right-panel {
    max-height: 60vh;
  }
}
