/* Styles for menus, profiles, settings, calls and other newer features. */

/* ---------- avatars & icons with images ---------- */

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar:has(img) {
  background: var(--bg-elevated);
}

.rail-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.rail-btn.has-icon {
  overflow: hidden;
  padding: 0;
}

.rail-item:hover .rail-btn.has-icon,
.rail-item.active .rail-btn.has-icon {
  background: var(--bg-elevated);
}

.clickable {
  cursor: pointer;
}

.mini-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  font-size: 10px;
  font-weight: 700;
}

.tiny-text {
  font-size: 11px;
}

/* ---------- context menu ---------- */

.ctx-menu {
  position: fixed;
  z-index: 50;
  min-width: 220px;
  max-width: 280px;
  padding: 6px;
  border-radius: 8px;
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  display: grid;
  gap: 1px;
}

.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 14px;
}

.ctx-item:hover,
.ctx-item:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.ctx-item.danger {
  color: var(--danger);
}

.ctx-item.danger:hover,
.ctx-item.danger:focus-visible {
  background: var(--danger);
  color: #fff;
}

.ctx-item:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.ctx-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--bg-elevated);
}

.ctx-header {
  padding: 6px 8px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ctx-slider {
  display: grid;
  gap: 6px;
  padding: 6px 8px 8px;
  font-size: 13px;
}

.ctx-slider-top {
  display: flex;
  justify-content: space-between;
}

.ctx-slider input {
  padding: 0;
  accent-color: var(--accent);
}

.ctx-value {
  color: var(--text-muted);
}

.ctx-check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--text-faint);
  border-radius: 4px;
}

.ctx-check.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- messages: tools & editing ---------- */

.message {
  position: relative;
}

.message-author {
  border: 0;
  padding: 0;
  background: none;
  font-weight: 600;
}

.message-author:hover {
  text-decoration: underline;
}

.message-tools {
  position: absolute;
  right: 16px;
  top: -14px;
  display: none;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.message:hover .message-tools {
  display: flex;
}

.tiny-tool {
  width: 28px;
  height: 28px;
}

.edited {
  font-size: 11px;
  color: var(--text-faint);
}

.message-editor {
  display: grid;
  gap: 4px;
  width: 100%;
}

.edit-box {
  resize: none;
  background: var(--bg-input);
}

/* ---------- headers & call panel ---------- */

.header-spacer {
  flex: 1;
}

.in-call {
  color: var(--ok);
}

.avatar-stack {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.call-panel {
  flex: none;
  display: flex;
  flex-direction: column;
  height: 44%;
  min-height: 260px;
  background: #121317;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}

.call-panel.has-screens {
  height: 62%;
}

.call-panel.compact {
  height: auto;
  min-height: 0;
  align-items: center;
  gap: 10px;
  padding: 20px;
}

.call-panel .stage-grid {
  padding: 12px;
}

.call-panel .stage-controls {
  padding: 8px 0 12px;
}

.calling {
  text-align: center;
  margin: 0;
}

.tile-full {
  position: absolute;
  right: 8px;
  top: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}

.tile:hover .tile-full {
  opacity: 1;
}

.tile.person {
  cursor: pointer;
}

.tile.screen:fullscreen {
  border-radius: 0;
}

/* ---------- incoming call ---------- */

.modal.call-modal {
  width: 300px;
}

.call-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 20px 24px;
  text-align: center;
}

.call-card h2 {
  margin: 10px 0 0;
}

.call-card .avatar {
  animation: ring 1.2s ease-in-out infinite;
}

@keyframes ring {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.6);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(47, 191, 113, 0);
  }
}

.call-actions {
  display: flex;
  gap: 32px;
  margin-top: 14px;
}

/* ---------- profile ---------- */

.modal.profile-modal {
  width: min(400px, calc(100% - 32px));
  overflow: hidden;
}

.profile-card {
  position: relative;
  overflow-y: auto;
}

.profile-banner {
  height: 96px;
  background: linear-gradient(135deg, hsl(var(--avatar-hue, 250) 60% 40%), hsl(calc(var(--avatar-hue, 250) + 40) 60% 30%));
}

.profile-avatar {
  position: absolute;
  top: 46px;
  left: 18px;
  padding: 6px;
  border-radius: 50%;
  background: var(--bg-main);
}

.profile-avatar .status {
  width: 22px;
  height: 22px;
  border-width: 4px;
  border-color: var(--bg-main);
}

.profile-info {
  padding: 56px 18px 18px;
}

.profile-info h2 {
  margin: 0;
}

.profile-info > p {
  margin: 2px 0 12px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-actions .btn,
.account-photo-actions .btn,
.btn.wide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.profile-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
}

.profile-section .section-title {
  margin: 8px 0 4px;
}

.profile-section p {
  margin: 0;
}

.bio {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- settings ---------- */

.settings-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 460px;
  max-height: calc(100vh - 140px);
}

.settings-nav {
  padding: 12px 8px;
  border-right: 1px solid var(--bg-elevated);
}

.settings-content {
  overflow-y: auto;
  padding: 4px 20px 20px;
}

.settings-panel {
  display: grid;
  gap: 14px;
}

.settings-panel h2 {
  margin: 12px 0 0;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.account-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.account-photo-actions p {
  width: 100%;
  margin: 0;
}

.server-icon-preview {
  width: 96px;
  height: 96px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--accent);
  font-size: 28px;
  font-weight: 700;
  overflow: hidden;
}

.server-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.label-row {
  display: flex;
  justify-content: space-between;
}

input.readonly {
  color: var(--text-muted);
}

.device-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.invite-code {
  font-family: Consolas, monospace;
  letter-spacing: 0.06em;
}

/* ---------- screen share dialog ---------- */

.share-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-sidebar);
}

.share-settings .share-sound,
.share-settings p {
  grid-column: 1 / -1;
  margin: 0;
}

/* ---------- update banner ---------- */

.update-banner {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.update-banner a.btn {
  text-decoration: none;
}

/* ---------- user panel, members, participants ---------- */

.user-chip {
  overflow: hidden;
  border: 0;
  background: none;
  padding: 2px 4px;
  border-radius: 6px;
  text-align: left;
}

.user-chip:hover {
  background: var(--bg-hover);
}

.user-chip-names {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.member {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
}

.voice-participant {
  cursor: pointer;
  border-radius: 6px;
}

.voice-participant:hover {
  background: var(--bg-hover);
}
