/* ============================================================
   VoxSign Shared UI — Design System
   统一变量、导航、页脚、基础排版
   所有页面通过 <link rel="stylesheet" href="/static/center/shared/shared-ui.css"> 引入
   ============================================================ */

/* --- CSS Variables --- */
/* Two palettes coexist:
 *
 *   • DEFAULT (admin/internal pages) — `--bg-primary` etc, dark theme.
 *     Used by /home, /dashboard, /memory, /monitor, /ops, /logs, /timeline
 *     and all to-B / operator surfaces. Optimized for long-staring at data.
 *
 *   • v3 EDITION I (public-facing) — paper / brass / ink palette.
 *     Used by /landing, /ar, /keyboard guide and any to-C surface.
 *     Per memory `feedback_2c_separation`: 网站主页只展示 VoxKeyboard,
 *     仓库降为 to B 入口. v3 tokens below match
 *     `docs/design/design_handoff_voxsign_v3 2/site/index.html`.
 *
 * Pages should pick ONE palette per surface; do not mix dark + paper
 * within a single page. Toggle by adding `class="v3-edition"` on <body>
 * to opt into the paper palette without re-declaring variables.
 */
:root {
  --bg-primary: #0a0e1a;
  --bg-card: #111827;
  --bg-elevated: #1e293b;
  --bg-hover: rgba(255,255,255,0.04);
  --border: #1e293b;
  --border-strong: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #4fc3f7;
  --accent-hover: #38bdf8;
  --accent-dim: rgba(79,195,247,0.12);
  --success: #4ade80;
  --success-dim: rgba(74,222,128,0.12);
  --danger: #f87171;
  --danger-dim: rgba(248,113,113,0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251,191,36,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Menlo', monospace;
  --nav-height: 52px;

  /* v3 Edition I tokens — paper / brass / ink (public-facing) */
  --paper:#F5F1EA;          /* warm off-white */
  --paper-2:#EDE6D9;        /* deeper paper for cards */
  --paper-3:#E3DAC8;        /* deepest paper / fills */
  --ink:#1A1614;            /* near-black warm */
  --ink-2:#3A3530;          /* secondary text */
  --ink-3:#6B6157;          /* tertiary / mono */
  --rule:#1A1614;           /* hairline rules */
  --rule-soft:rgba(26,22,20,0.12);
  --brass:#B08A4E;          /* the metal */
  --brass-deep:#8C6A36;
  --brass-tint:rgba(176,138,78,0.10);
  --live:#22D3EE;           /* single-pulse cyan only */
  --warn:#C4451E;           /* terra-cotta, not red */
  --good:#3F6B4F;           /* moss, not green */
  --type-mono:"JetBrains Mono", "SF Mono", Menlo, monospace;
  --type-sans:"Inter", -apple-system, system-ui, sans-serif;
  --type-display:"Fraunces", "Times New Roman", Georgia, serif;
}

/* v3 Edition I — opt-in via <body class="v3-edition"> */
body.v3-edition {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--type-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.v3-edition a { color: inherit; }
body.v3-edition ::selection { background: var(--brass); color: var(--paper); }
body.v3-edition .v3-kicker {
  font-family: var(--type-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
body.v3-edition .v3-kicker::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--ink-3);
}
body.v3-edition .v3-display {
  font-family: var(--type-display);
  font-weight: 400;
  letter-spacing: -0.02em;
}
body.v3-edition .v3-rule { height: 1px; background: var(--rule); width: 100%; }
body.v3-edition .v3-rule-soft { height: 1px; background: var(--rule-soft); width: 100%; }

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}

/* RTL support */
[dir="rtl"] { direction: rtl; text-align: right; }

/* --- Shared Navigation --- */
.vx-nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(17,24,39,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vx-nav-logo {
  display: inline-flex; align-items: baseline; gap: 1px;
  font-family: var(--type-display); font-size: 18px; font-weight: 500;
  color: var(--text-primary); text-decoration: none;
  white-space: nowrap; flex-shrink: 0; letter-spacing: 0;
}
.vx-nav-logo span { color: var(--brass); font-style: italic; font-weight: 500; }

.vx-nav-links {
  display: flex; gap: 2px; align-items: center;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.vx-nav-links::-webkit-scrollbar { display: none; }

.vx-nav-links a {
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-sm);
  white-space: nowrap; transition: all 0.15s;
}
.vx-nav-links a:hover { color: var(--text-primary); background: var(--bg-hover); }
.vx-nav-links a.active { color: var(--accent); background: var(--accent-dim); }

.vx-nav-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* Language switcher */
.vx-lang-switcher {
  display: flex; gap: 2px;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  padding: 2px;
}
.vx-lang-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 4px; cursor: pointer; transition: all 0.15s;
}
.vx-lang-btn:hover { color: var(--text-primary); }
.vx-lang-btn.active { color: var(--accent); background: var(--accent-dim); }

/* User menu */
.vx-user-info {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
}
.vx-user-tenant {
  color: var(--text-secondary); font-weight: 600;
}
.vx-logout-btn {
  background: none; border: 1px solid var(--border-strong);
  color: var(--text-muted); padding: 4px 10px;
  border-radius: var(--radius-sm); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
}
.vx-logout-btn:hover { color: var(--danger); border-color: var(--danger); }

/* --- Shared Footer --- */
.vx-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
.vx-footer a {
  color: var(--text-muted); text-decoration: none;
  transition: color 0.15s;
}
.vx-footer a:hover { color: var(--accent); }
.vx-footer .sep { opacity: 0.3; }

/* --- Utility Classes --- */
.vx-container { max-width: 960px; margin: 0 auto; padding: 24px 16px; flex: 1; }
.vx-container-narrow { max-width: 640px; margin: 0 auto; padding: 24px 16px; flex: 1; }
.vx-container-wide { max-width: 1200px; margin: 0 auto; padding: 24px 16px; flex: 1; }

.vx-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
  box-shadow: var(--shadow-card);
}

.vx-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
}
.vx-btn-primary { background: #2563eb; color: #fff; }
.vx-btn-primary:hover { background: #1d4ed8; }
.vx-btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.vx-btn-secondary:hover { color: var(--text-primary); border-color: var(--text-muted); }
.vx-btn-danger { background: var(--danger-dim); color: var(--danger); }
.vx-btn-danger:hover { background: rgba(248,113,113,0.2); }
.vx-btn-success { background: var(--success-dim); color: var(--success); }

.vx-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.vx-badge-blue { background: rgba(37,99,235,0.2); color: #60a5fa; }
.vx-badge-green { background: var(--success-dim); color: var(--success); }
.vx-badge-red { background: var(--danger-dim); color: var(--danger); }
.vx-badge-yellow { background: var(--warning-dim); color: var(--warning); }
.vx-badge-gray { background: var(--bg-elevated); color: var(--text-muted); }

.vx-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-primary); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 15px; font-family: var(--font-sans);
  outline: none; transition: border-color 0.15s;
}
.vx-input:focus { border-color: var(--accent); }
.vx-input::placeholder { color: var(--text-muted); }

.vx-label {
  display: block; font-size: 13px; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 500;
}

/* Status dots */
.vx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.vx-dot-green { background: var(--success); box-shadow: 0 0 6px var(--success); }
.vx-dot-red { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.vx-dot-yellow { background: var(--warning); }
.vx-dot-gray { background: var(--text-muted); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .vx-nav { padding: 0 12px; }
  .vx-nav-links a { font-size: 12px; padding: 5px 8px; }
  .vx-user-info .vx-user-email { display: none; }
  .vx-container, .vx-container-narrow { padding: 16px 12px; }
}

@media (max-width: 480px) {
  .vx-nav-logo { font-size: 15px; }
  .vx-lang-switcher { display: none; }
  .vx-footer { flex-direction: column; gap: 4px; text-align: center; }
}
