/* ============================================
   速创智算客户端网关 v3 — 清新主题
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8faff;
  --bg-elevated: #eef2f7;
  --bg-hover: rgba(79, 143, 247, 0.06);
  --bg-active: rgba(79, 143, 247, 0.10);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #4f8ff7;
  --accent-hover: #3b7de6;
  --accent-light: rgba(79, 143, 247, 0.08);
  --accent-gradient: linear-gradient(135deg, #4f8ff7, #7c5cfc);
  --accent-gradient-2: linear-gradient(135deg, #4f8ff7, #3b7de6);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.07);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.09);
  --shadow-glow: 0 2px 12px rgba(79, 143, 247, 0.25);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-height: 52px;
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 14px;
}

/* --- Header / Nav Bar --- */
.header {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 6px;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}
.logo {
  font-size: 15px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  letter-spacing: 0.3px;
  margin-right: 8px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav a:hover {
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}
.nav a.active {
  color: #fff;
  background: var(--accent-gradient);
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}
.user-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.user-info .balance {
  color: var(--accent);
  font-weight: 600;
}

/* ===== Nav Bar (gateway pages) ===== */
.nav-bar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e6eb;
  gap: 4px;
  flex-shrink: 0;
}
.nav-bar a {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: #4e5969;
  text-decoration: none;
  white-space: nowrap;
}
.nav-bar a:hover {
  background: #f5f6f8;
}
.nav-bar a.active {
  color: #1677ff;
  background: rgba(22, 119, 255, 0.08);
  font-weight: 600;
}
.nav-bar .user-info {
  font-size: 11px;
  color: #86909c;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-bar .logout-btn {
  color: #86909c;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.nav-bar .logout-btn:hover {
  background: #fef2f2;
  color: #ef4444;
}
}
.user-info .logout-btn {
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 12px;
}
.user-info .logout-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
  transform: translateY(-1px);
}

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.card-header {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Buttons --- */
.btn {
  padding: 8px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: white;
  box-shadow: 0 1px 6px rgba(79, 143, 247, 0.12);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--accent-light);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--border);
}
.btn-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-bg);
  box-shadow: 0 1px 6px rgba(239, 68, 68, 0.15);
  transform: translateY(-1px);
}

.btn-sm { padding: 5px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 4px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* --- Form Fields --- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  font-family: inherit;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 143, 247, 0.10);
  background: #fff;
}

/* --- Table --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 14px;
  opacity: 0.25;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.empty-state p {
  font-size: 14px;
  opacity: 0.7;
}

/* --- Modal / Overlay --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: slideUp 0.25s ease;
}
.modal h2 {
  font-size: 17px;
  margin-bottom: 6px;
  font-weight: 600;
}
.modal p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* --- Grid Utilities --- */
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c9cdd4; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a9adb4; }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Links --- */
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* --- Selection --- */
::selection { background: rgba(79, 143, 247, 0.18); }

/* --- Dark Theme --- */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-elevated: #1e293b;
  --bg-hover: rgba(79, 143, 247, 0.12);
  --bg-active: rgba(79, 143, 247, 0.18);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* --- Scene-based UI adjustments --- */
[data-scene="office"] .scene-indicator { color: var(--accent); }
[data-scene="leisure"] .scene-indicator { color: #8b5cf6; }

/* --- Auto theme transition --- */
body { transition: background-color 0.3s, color 0.3s; }
