/* ══════════════════════════════════════════════
   GSC+PSI MCP — Glass UI Design System
   Based on mcp-glass-ui tokens
   ══════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  /* Backgrounds */
  --ink: #0a0e1a;
  --ink-2: #0f1629;
  --ink-3: #141b2d;

  /* Glass layers */
  --film: rgba(255,255,255,0.06);
  --film-hover: rgba(255,255,255,0.09);
  --glass-base: rgba(13,18,32,0.52);
  --glass-blur: blur(22px) saturate(160%);
  --glass-line: rgba(255,255,255,0.14);
  --glass-line-hover: rgba(255,255,255,0.22);
  --rim: inset 0 1px 0 rgba(255,255,255,0.16);

  /* Brand */
  --accent: #20808d;
  --primary: #1a73e8;
  --violet: #8b5cf6;
  --teal: #3fc7b8;
  --coral: #e2725b;

  /* Semantic */
  --text: #e8eaf0;
  --text-dim: #8b8fa7;
  --text-muted: #555a70;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Typography */
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;

  /* Spacing & Radius */
  --radius: 24px;
  --radius-in: 18px;
  --radius-sm: 12px;
  --gap: 16px;
  --gap-sm: 8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Layout ── */
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* ── Glass Panels ── */
.glass {
  background: var(--glass-base);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: var(--rim), 0 8px 32px rgba(0,0,0,0.3);
  padding: 24px;
}

.glass-in {
  background: var(--film);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-in);
  padding: 16px;
}

.glass-in:hover {
  background: var(--film-hover);
  border-color: var(--glass-line-hover);
}

@supports not (backdrop-filter: blur(1px)) {
  .glass { background: rgba(13,18,32,0.92); }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--glass-line); }
.btn-ghost:hover { background: var(--film-hover); border-color: var(--glass-line-hover); }

.btn-blue { background: var(--primary); color: #fff; }
.btn-blue:hover { filter: brightness(1.15); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.15); }

.btn-lg { padding: 12px 28px; font-size: var(--fs-base); font-weight: 600; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.badge-active { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(139,92,246,0.15); color: var(--violet); }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--glass-line);
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.table tr:hover td { background: var(--film); }
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* ── Progress Bar ── */
.bar { height: 6px; background: var(--film); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; transition: width 0.5s; }
.bar-ok > div { background: var(--success); }
.bar-warn > div { background: var(--warning); }
.bar-danger > div { background: var(--danger); }

/* ── Cards & Layout ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.stat-row { display: flex; gap: var(--gap); flex-wrap: wrap; }

.stat-card { flex: 1; min-width: 140px; }
.stat-card .label {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card .value {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Toast Notifications ── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  animation: slideIn 0.3s ease;
  z-index: 9999;
  max-width: 360px;
}
.toast-ok { background: rgba(34,197,94,0.9); color: #fff; }
.toast-error { background: rgba(239,68,68,0.9); color: #fff; }
.toast-warn { background: rgba(245,158,11,0.9); color: #000; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ── Code Box ── */
.code-box {
  background: var(--ink-2);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--teal);
  word-break: break-all;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s;
}
.code-box:hover { border-color: var(--glass-line-hover); }
.code-box .copy-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-family: var(--font);
}

/* ── Form Fields ── */
.field { margin-bottom: var(--gap); }
.field label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--ink-2);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}
.field input::placeholder { color: var(--text-muted); }

/* ── Section Headers ── */
.section-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--gap);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Tool List ── */
.tool-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tool-item:last-child { border-bottom: none; }
.tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.tool-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  color: var(--teal);
}
.tool-desc {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .wrap { padding: 16px; }
  .glass { padding: 16px; border-radius: var(--radius-in); }
  .stat-row { flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .btn-lg { width: 100%; justify-content: center; }
}

/* ── Utilities ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-teal { color: var(--teal); }
.text-violet { color: var(--violet); }
.mono { font-family: var(--font-mono); }
.mt { margin-top: var(--gap); }
.mb { margin-bottom: var(--gap); }
.mt-sm { margin-top: var(--gap-sm); }
.mb-sm { margin-bottom: var(--gap-sm); }
.gap { gap: var(--gap); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.tabnum { font-variant-numeric: tabular-nums; }
