/* ── Plexus Relay — Federation dark theme ─────────────────────────── */

:root {
  --bg-deep:     #0a0a0f;
  --bg-panel:    #111118;
  --bg-card:     #1a1a24;
  --bg-input:    #15151f;
  --border:      #2a2a3a;
  --text:        #d0d0d8;
  --text-dim:    #707080;
  --accent:      #00ccbb;
  --accent-glow: rgba(0, 204, 187, 0.15);
  --red:         #ff4455;
  --green:       #00cc88;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:        'SF Mono', 'Consolas', 'Monaco', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  transition: background 0.3s;
}

.status-dot.connected { background: var(--green); }

.main {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.mind-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.mind-card:hover {
  border-color: var(--accent);
}

.mind-card .mind-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.mind-card .mind-stats {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ── Stream ─────────────────────────────────────────────────────── */
.stream-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  max-width: 720px;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.msg-name {
  font-weight: 700;
  font-size: 13px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.msg-text {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Compose bar ────────────────────────────────────────────────── */
.compose {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.compose select {
  background: var(--bg-input);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}

.compose select:focus {
  border-color: var(--accent);
}

.compose .input-wrap {
  flex: 1;
  position: relative;
}

.compose textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 60px 8px 12px;
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  rows: 1;
  height: 40px;
  outline: none;
  transition: border-color 0.2s;
}

.compose textarea:focus {
  border-color: var(--accent);
}

.compose .char-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  pointer-events: none;
}

.compose .char-count.warn { color: var(--red); }

.compose button {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.compose button:hover { opacity: 0.85; }
.compose button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

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

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar {
    display: none;
  }
  .compose {
    flex-wrap: wrap;
    gap: 8px;
  }
  .compose select {
    flex-shrink: 0;
  }
  .compose .input-wrap {
    min-width: 0;
    flex: 1 1 100%;
    order: 2;
  }
  .compose button {
    order: 3;
    flex: 1 1 100%;
  }
}
