/* ============================================================
   ARIA Design System — openclaw-inspired, blue accent
   ============================================================ */

/* ── Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Backgrounds — 4-level depth */
  --bg:           #080e1a;
  --bg-elevated:  #0d1525;
  --bg-card:      #111c2e;
  --bg-hover:     #16223a;

  /* Text */
  --text:         #ccd8ea;
  --text-strong:  #eef2f8;
  --text-muted:   #4d6a87;
  --text-subtle:  #2e4560;

  /* Borders — whisper-thin */
  --border:       rgba(0, 130, 230, 0.10);
  --border-mid:   rgba(0, 130, 230, 0.18);
  --border-strong:rgba(0, 130, 230, 0.28);

  /* Accent — Blue */
  --accent:        #0082e6;
  --accent-hover:  #1a90f0;
  --accent-subtle: rgba(0, 130, 230, 0.10);
  --accent-glow:   rgba(0, 130, 230, 0.22);
  --accent-light:  #66b3ff;
  --accent-dark:   #005ab5;

  /* Semantic */
  --success:       #22c55e;
  --success-subtle:rgba(34, 197, 94, 0.10);
  --warning:       #f59e0b;
  --warning-subtle:rgba(245, 158, 11, 0.10);
  --danger:        #ef4444;
  --danger-subtle: rgba(239, 68, 68, 0.10);

  /* Orange — ARIA secondary brand */
  --orange:        #d4681a;
  --orange-subtle: rgba(212, 104, 26, 0.12);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full:9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Transitions */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   100ms;
  --dur-normal: 180ms;
  --dur-slow:   300ms;

  /* Shell dimensions */
  --sidebar-w:      230px;
  --topbar-h:       52px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent-subtle);
  color: var(--text-strong);
}

/* ── Scrollbars — minimal ────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.07);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.13); }

/* ── Shell layout ────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  overflow: hidden;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar::before {
  content: '';
  display: block;
  height: 2px;
  flex-shrink: 0;
  background: linear-gradient(90deg,
    transparent,
    rgba(0,130,230,0.6),
    rgba(212,104,26,0.35),
    rgba(0,130,230,0.6),
    transparent
  );
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 14px 10px 12px;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  line-height: 1.1;
}

.brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 0;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group {
  margin-bottom: 18px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active, .nav-item--active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(0,130,230,0.18);
  font-weight: 600;
}

.nav-icon {
  font-size: 15px;
  width: 17px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon,
.nav-item--active .nav-icon {
  opacity: 1;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  padding: 0 24px;
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 26, 0.85);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 12px;
}

.topbar-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 2px;
}

.topbar-spacer { flex: 1; }

/* ── Content area ────────────────────────────────────────── */
.content {
  grid-area: content;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 48px;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Cards / Sections ────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 18px;
}

/* ── Stat grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  transition: border-color var(--dur-fast) ease;
}

.stat-card:hover { border-color: var(--border-mid); }

.stat-card.highlight { border-color: var(--border-strong); }
.stat-card.highlight .stat-value { color: var(--accent); }

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-strong);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── Data table ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 18px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
}

.badge-blue    { background: var(--accent-subtle);   color: var(--accent); }
.badge-green   { background: var(--success-subtle);  color: var(--success); }
.badge-orange  { background: var(--warning-subtle);  color: var(--warning); }
.badge-red     { background: var(--danger-subtle);   color: var(--danger); }
.badge-muted   { background: var(--bg-hover);        color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  transition:
    background var(--dur-fast) ease,
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 18px var(--accent-glow); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

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

.btn-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 22px; font-size: 15px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-subtle); }

.form-textarea { min-height: 80px; resize: vertical; font-family: var(--font-body); }

/* ── Pills / status dots ─────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online  { background: var(--success); box-shadow: 0 0 0 3px var(--success-subtle); }
.status-dot.offline { background: var(--text-subtle); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-subtle); }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* ── Banners / alerts ────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-subtle); border-color: rgba(34,197,94,0.25); color: #4ade80; }
.alert-warning { background: var(--warning-subtle); border-color: rgba(245,158,11,0.25); color: #fbbf24; }
.alert-error   { background: var(--danger-subtle);  border-color: rgba(239,68,68,0.25);  color: #f87171; }
.alert-info    { background: var(--accent-subtle);  border-color: var(--border-mid);      color: var(--accent); }

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

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.animate-rise    { animation: rise    var(--dur-slow) var(--ease-out) both; }
.animate-fade    { animation: fade-in var(--dur-normal) ease both; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-md);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
      "topbar"
      "content";
  }
  .sidebar { display: none; }
  .content { padding: 18px 16px 36px; }
}
