/* ============ Wide modal / scrollable modal content ============ */
.wide-modal {
  max-width: none;
  max-height: 100dvh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wide-modal > .modal-back-link {
  flex: 0 0 auto;
  margin: 20px clamp(24px, 5vw, 64px) 0;
}

.wide-modal h3 {
  padding: 24px 28px 16px;
  margin: 0;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 clamp(24px, 5vw, 64px) 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-x {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s ease;
}

.profile-link {
  border: 0;
  padding: 0;
  min-height: 0 !important;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.profile-link:hover,
.profile-link:focus-visible {
  color: var(--btn-a);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.profile-private-note {
  max-width: 900px;
  margin: 0 auto 20px;
  padding: 20px;
  color: var(--text-dim);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
}

.profile-private-note[hidden],
.profile-wrap[hidden],
[data-profile-owner-only][hidden] {
  display: none !important;
}

.modal-backdrop > .modal.community-modal {
  width: 100vw !important;
  max-height: 100dvh !important;
}

.community-modal > .web-list,
.community-modal > .group-list {
  max-height: none;
}

.modal-x:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.16);
}

.friends-wrap { display: flex; flex-direction: column; gap: 12px; }

/* .group-card is now a <button> (opens the group overlay instead of navigating) */
button.group-card {
  width: 100%;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-display);
  text-align: left;
}

/* ============ Group overlay (Discord-style, covers whole page) ============ */
.group-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-base);
  background-image: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.18s ease;
}

.group-overlay[hidden] { display: none !important; }

.go-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.go-header h1 {
  flex: 1;
  font-size: 18px;
  margin: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.go-group-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-right: auto;
}

.go-group-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-muted);
}

.go-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

#go-error { margin: 16px 24px 0; }

.go-body {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}

.go-branches {
  border-right: 1px solid var(--border);
  background: var(--surface-muted);
  padding: 18px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.go-branches .branch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.go-branches .branch-row,
.go-branches .branch-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-family: var(--font-display);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.go-branches .branch-row-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.go-branches .branch-row-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--btn-a);
}

.go-branches .branch-type {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.go-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 24px 24px;
  gap: 14px;
}

.go-chat-header {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  padding-bottom: 4px;
}

.typing-status {
  min-height: 0;
  padding: 0 16px 6px;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

.typing-status[hidden] { display: none; }

.group-logo-form {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.group-logo-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  object-fit: cover;
}

.group-logo-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.group-logo-controls input { max-width: 100%; }

@media (max-width: 600px) {
  .go-group-identity { gap: 8px; }
  .go-group-logo { width: 34px; height: 34px; flex-basis: 34px; }
  .group-logo-form { align-items: flex-start; }
}

.go-chat .messages {
  flex: 1;
  min-height: 0;
}

@media (max-width: 760px) {
  .go-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .go-branches {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 180px;
  }
}
