*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101010;
  color: #f5f5f5;
}

body {
  display: flex;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top bar */

.top-bar {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  background: #18181b;
  border-bottom: 1px solid #27272f;
  gap: 8px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #22c55e;
}

.app-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.top-center {
  flex: 1;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.top-right {
  display: flex;
  align-items: center;
}

.username-input {
  height: 28px;
  border-radius: 999px;
  border: 1px solid #363645;
  background: #111115;
  color: #f5f5f5;
  padding: 0 10px;
  font-size: 12px;
  outline: none;
  min-width: 0;
}

.username-input::placeholder {
  color: #6b6b7f;
}

/* Layout */

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

/* Sidebar */

.sidebar {
  width: 210px;
  background: #111116;
  border-right: 1px solid #27272f;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section {
  background: #15151c;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 4px;
}

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

.channel-item {
  border: none;
  outline: none;
  background: transparent;
  color: #d4d4e0;
  text-align: left;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  cursor: pointer;
}

.channel-item-active {
  background: #27272f;
}

.user-list {
  max-height: 110px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  background: #181821;
}

.user-avatar {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.user-self {
  color: #22c55e;
}

.users-section {
  flex: 1;
}

/* Photon admin panel */

.photon-admin.hidden {
  display: none;
}

.photon-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field span {
  font-size: 11px;
  color: #a1a1b0;
}

.field input {
  border-radius: 4px;
  border: 1px solid #31313f;
  background: #101018;
  color: #f5f5f5;
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
}

.btn-primary {
  margin-top: 4px;
  border-radius: 4px;
  border: none;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  background: #22c55e;
  color: #020617;
  cursor: pointer;
}

/* Photon status badge */

.photon-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.photon-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #6b7280;
}

.photon-status-disconnected {
  color: #f97373;
  border-color: #4b1d1d;
}

.photon-status-disconnected::before {
  background: #f97373;
}

.photon-status-connecting {
  color: #eab308;
  border-color: #3f3f18;
}

.photon-status-connecting::before {
  background: #eab308;
}

.photon-status-connected {
  color: #22c55e;
  border-color: #123322;
}

.photon-status-connected::before {
  background: #22c55e;
}

/* Chat area */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #050509;
}

.chat-header {
  padding: 8px 10px;
  border-bottom: 1px solid #27272f;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
}

.chat-title .hash {
  color: #a1a1b0;
}

.chat-header-status {
  font-size: 11px;
  color: #9ca3af;
}

/* Messages */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.message-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.message-main {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.message-username {
  font-weight: 600;
  font-size: 13px;
}

.message-username.self {
  color: #22c55e;
}

.message-timestamp {
  font-size: 10px;
  color: #9ca3af;
}

.message-body {
  font-size: 13px;
  word-wrap: break-word;
  white-space: pre-wrap;
  color: #e5e5f0;
}

/* Input bar */

.message-input-bar {
  padding: 8px 10px;
  border-top: 1px solid #27272f;
  display: flex;
  gap: 6px;
}

.message-input-bar input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #363645;
  background: #111115;
  color: #f5f5f5;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

.message-input-bar input::placeholder {
  color: #6b6b7f;
}

.btn-send {
  border-radius: 999px;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  background: #22c55e;
  color: #020617;
  cursor: pointer;
}

/* Mobile */

@media (max-width: 768px) {
  .sidebar {
    width: 150px;
  }

  .top-center {
    display: none;
  }

  .top-bar {
    justify-content: space-between;
  }

  .chat-header-status {
    display: none;
  }

  .messages {
    padding: 8px;
  }

  .user-list {
    max-height: 80px;
  }
}