/* main.css — layout, design tokens, sidebar, content area. */

:root {
  --bg:            #0f172a;   /* slate-900 */
  --bg-elev-1:    #1e293b;   /* slate-800 */
  --bg-elev-2:    #334155;   /* slate-700 */
  --border:        #334155;
  --text:          #f1f5f9;   /* slate-100 */
  --text-muted:    #94a3b8;   /* slate-400 */
  --text-subtle:   #64748b;   /* slate-500 */

  --accent:        #ef4444;   /* red-500 — emergency feel */
  --accent-hover:  #dc2626;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;

  --radius:        8px;
  --radius-sm:     6px;
  --shadow:        0 4px 12px rgba(0,0,0,0.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --sidebar-width: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}

/* --- App shell --- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;  /* Footer must be reachable on short viewports */
}

.sidebar-header {
  padding: 0 8px 20px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: left;
  transition: background-color 120ms, color 120ms;
}
.nav-item:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--bg-elev-2);
  color: var(--text);
}
.nav-icon { display: inline-flex; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}
.connection-label {
  font-size: 12px;
  color: var(--text-muted);
}
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
}
.connection-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.connection-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}
.connection-dot.unknown {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.debug-hint {
  font-size: 11px;
  color: var(--text-subtle);
  padding: 6px 8px;
}

/* --- Content area --- */

.content {
  padding: 32px;
  overflow-x: auto;
}
.tab-content {
  max-width: 1200px;
}

.placeholder {
  background: var(--bg-elev-1);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}
.placeholder h2 {
  margin: 0 0 8px 0;
  color: var(--text);
}

.error-state {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--danger);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-item {
    flex: 1 1 auto;
  }
  .nav-label { display: none; }
  .sidebar-footer { display: none; }
  .content { padding: 16px; }
}
