/* layout.css — screen composition */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.45);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark-sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.brand-subtitle { margin: 2px 0 0; font-size: 0.78rem; color: var(--text-muted); }

.chat-screen {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.rail {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.1rem;
  gap: 1rem;
}
.rail-top { display: flex; align-items: center; gap: 0.6rem; }
.rail-brand { font-weight: 700; font-size: 0.92rem; flex: 1; }

.identity-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}
.identity-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.identity-text { min-width: 0; }
.identity-name { font-weight: 600; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-role { font-size: 0.72rem; color: var(--text-muted); }
.identity-chip .icon-btn { margin-left: auto; }

.rail-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.room-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.room-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.room-item:hover { background: var(--surface); }
.room-item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.room-hash { opacity: 0.6; }
.room-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-count { font-size: 0.7rem; opacity: 0.6; }

.friend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.friends-block { display: flex; flex-direction: column; gap: 0.6rem; }

.code-chip {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.code-chip:hover { border-color: var(--accent); }

.code-expiry {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.room-form { display: flex; gap: 0.5rem; }
.room-form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
}
.room-form input:focus { border-color: var(--accent); }

.conversation { display: flex; flex-direction: column; min-width: 0; }

.conversation-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}
.room-title { font-weight: 700; font-size: 0.95rem; }
.room-title::before { content: '#'; opacity: 0.5; margin-right: 2px; }
.room-title.is-dm::before { content: '@'; }
.room-title.is-p2p::before { content: ''; margin-right: 0; }

.typing-indicator { font-size: 0.78rem; color: var(--text-muted); opacity: 0; transition: opacity 0.2s ease; display: flex; align-items: center; gap: 0.4rem; }
.typing-indicator.is-visible { opacity: 1; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); display: inline-block; animation: bounce 1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }

.encryption-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--success);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.message-stream { position: relative; flex: 1; overflow: hidden; }
.message-pane {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  opacity: 0;
  pointer-events: none;
}
.message-pane.is-visible { opacity: 1; pointer-events: auto; }

.bubble-row { max-width: 68%; animation: rise 0.28s ease; }
.bubble-meta { display: flex; gap: 0.5rem; align-items: baseline; margin-bottom: 0.2rem; }
.bubble-sender { font-weight: 700; font-size: 0.78rem; color: var(--accent-strong); }
.bubble-time { font-size: 0.68rem; color: var(--text-muted); }
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.is-failed .bubble { border-color: var(--danger); color: var(--danger); }
.system-line { text-align: center; font-size: 0.74rem; color: var(--text-muted); margin: 0.2rem 0; }

.composer { display: flex; gap: 0.7rem; padding: 1.1rem 1.4rem; border-top: 1px solid var(--border); }
.composer input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}
.composer input:focus { border-color: var(--accent); }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 300px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.drawer-head h2 { margin: 0; font-size: 1.05rem; }
.setting-line { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0; font-size: 0.88rem; }
.drawer-footnote { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; margin-top: 1.4rem; }

.p2p-panel { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1.2rem; }
.p2p-link-row { display: flex; gap: 0.5rem; }
.p2p-link-row input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.p2p-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}
.p2p-status-live { color: var(--success); }
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.pulse-dot-live { background: var(--success); }

@media (max-width: 760px) {
  .chat-screen { grid-template-columns: 1fr; }
  .rail { display: none; }
}
