/* MeshChat — simple, functional, no-dependency styling. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}

/* ---- auth pages ---- */
.auth-wrap {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: #ffffff;
  width: 100%;
  max-width: 380px;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.auth-title { margin: 0 0 4px; font-size: 22px; }
.auth-sub { margin: 0 0 20px; color: #6b7280; font-size: 14px; }
.auth-switch { margin-top: 18px; font-size: 14px; color: #6b7280; }
.auth-switch a { color: #2563eb; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
}
.form-row input:focus { outline: 2px solid #3b82f6; border-color: transparent; }
.form-actions { margin-top: 20px; }
.form-actions button, .btn {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.form-actions button:hover, .btn:hover { background: #1d4ed8; }

.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---- chat ---- */
.chat-app {
  display: flex;
  height: 100vh;
}

.chat-sidebar {
  width: 260px;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  flex-direction: column;
  flex: none;
}

.chat-sidebar .sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 700;
  font-size: 15px;
}

.chat-sidebar .sidebar-user {
  padding: 8px 16px;
  font-size: 13px;
  color: #6b7280;
  border-bottom: 1px solid #f3f4f6;
}

.roster { overflow-y: auto; flex: 1; }
.roster a {
  display: block;
  padding: 10px 16px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}
.roster a:hover { background: #f3f4f6; }
.roster a.active { background: #eff6ff; border-left: 3px solid #2563eb; }

.sidebar-section-title {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.inbox { border-bottom: 1px solid #e5e7eb; }
.inbox a {
  display: block;
  padding: 8px 16px;
  color: inherit;
  text-decoration: none;
}
.inbox a:hover { background: #f3f4f6; }
.inbox a.active { background: #eff6ff; border-left: 3px solid #2563eb; }
.inbox-line { display: flex; flex-direction: column; }
.inbox-peer { font-size: 14px; font-weight: 600; }
.inbox-preview {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-header .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; margin-right: 6px; }
.chat-header .dot.on { background: #22c55e; }

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

.msg {
  max-width: 65%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}
.msg.me { align-self: flex-end; background: #2563eb; color: #fff; border-color: #2563eb; }
.msg .who { font-size: 12px; opacity: 0.7; }
.msg .ts { font-size: 11px; opacity: 0.6; margin-left: 8px; }

.composer {
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  gap: 10px;
}
.composer input, .composer textarea {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
}
.composer .btn { width: auto; padding: 11px 20px; }

.chat-placeholder {
  padding: 60px 24px;
  color: #6b7280;
  text-align: center;
  font-size: 15px;
}
