:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-2: rgba(17, 24, 39, 0.96);
  --border: rgba(148, 163, 184, 0.14);
  --text: #eff6ff;
  --muted: #cbd5e1;
  --accent: #8b5cf6;
  --accent-2: #38bdf8;
  --success: #22c55e;
  --shadow: 0 18px 40px rgba(8, 15, 28, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, #172554 0%, #0b1220 35%, #020617 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }

::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

.app-shell {
  display: grid;
  grid-template-columns: 82px 340px 1fr;
  min-height: 100vh;
  overflow: hidden;
}

.server-bar {
  background: linear-gradient(180deg, #030712, #070b14 55%, #020617);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
}

.server-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(17, 24, 39, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.14);
  color: #eff6ff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}

.server-icon:hover { transform: translateY(-1px); border-color: rgba(56, 189, 248, 0.35); }
.server-icon.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: rgba(191, 219, 254, 0.35);
}

.sidebar {
  background: linear-gradient(180deg, rgba(8, 15, 28, 0.98), rgba(15, 23, 42, 0.98));
  border-right: 1px solid var(--border);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-header {
  padding: 6px 8px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-header h2 {
  margin: 4px 0 6px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.68rem;
  color: #c4b5fd;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.section-title {
  color: #dbeafe;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #e5eef8;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.channel-item:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.18);
  transform: translateX(2px);
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-delete {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
}

.channel-delete:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.channel-item.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(56, 189, 248, 0.12));
  border-color: rgba(192, 132, 252, 0.28);
}

.channel-hash { color: #7dd3fc; font-weight: 800; }

.panel-card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

.info-list li::before { content: '• '; color: #7dd3fc; }

.profile-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  font-weight: 800;
  color: #fff;
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.18);
}

.avatar.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.profile-box small { display: block; color: var(--muted); margin-top: 2px; }

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.92), rgba(15, 23, 42, 0.92));
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.88));
}

.chat-header h1 {
  margin: 2px 0 6px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 10px;
  color: #e2e8f0;
  font-size: 0.88rem;
}

.message-list {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.97), rgba(15, 23, 42, 0.96));
  box-shadow: var(--shadow);
}

.message-card:hover { border-color: rgba(56, 189, 248, 0.18); }
.message-body { min-width: 0; }
.message-meta {
  display:flex;
  align-items:baseline;
  gap:8px;
  margin-bottom:6px;
}

.message-meta strong { font-size: 0.98rem; }
.message-meta span { color: #94a3b8; font-size: 0.85rem; }
.message-body p {
  margin: 0;
  color: #edf2ff;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: auto;
  align-items: flex-end;
}
.message-actions button {
  background: transparent;
  border: 1px solid rgba(148,163,184,0.06);
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.message-actions button:hover { color: #fff; border-color: rgba(56,189,248,0.14); }

.edit-input {
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 56px;
  border: 1px solid var(--border);
  background: rgba(10,15,27,0.9);
  color: var(--text);
}
.edit-controls { display:flex; gap:8px; margin-top:8px; }
.edit-save, .edit-cancel { padding:6px 10px; border-radius:8px; border: none; cursor: pointer; }
.edit-save { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; font-weight:800; }
.edit-cancel { background: rgba(148,163,184,0.06); color: var(--muted); }

.edited { color: #9ca3af; font-size: 0.8rem; margin-left:8px; }

.message-list { scroll-behavior: smooth; }

.attachment { margin-top:8px; }
.attachment a { color: #93c5fd; text-decoration: none; border: 1px solid rgba(148,163,184,0.06); padding:6px 8px; border-radius:8px; background: rgba(10,15,27,0.6); }

.reaction-btn { background: rgba(255,255,255,0.02); border: 1px solid rgba(148,163,184,0.06); color: var(--muted); padding:6px 8px; border-radius:10px; cursor:pointer; font-weight:700; }
.reaction-btn:hover { color: #fff; border-color: rgba(56,189,248,0.12); }

#attachBtn, #createChannelBtn { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; border: none; padding:8px 10px; border-radius:10px; cursor:pointer; font-weight:700; }
#attachBtn:hover, #createChannelBtn:hover { filter:brightness(1.03); }

#typingIndicator { min-height: 22px; }

.empty-state {
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.92), rgba(15, 23, 42, 0.92));
  box-shadow: var(--shadow);
}

.composer {
  border-top: 1px solid var(--border);
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 27, 0.98));
}

.composer-label {
  display:block;
  color: #eff6ff;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.composer-row { display:flex; gap: 10px; }

.composer input {
  flex: 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  padding: 12px 14px;
  min-height: 50px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.composer input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.composer button {
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(139, 92, 246, 0.25);
  transition: transform .15s ease, filter .15s ease;
}

.composer button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.composer-note {
  color: #dbeafe;
  font-size: 0.88rem;
  margin: 8px 0 0;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 78px 300px 1fr; }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .server-bar {
    flex-direction: row;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    border-right: none;
    padding: 12px 10px;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

