/* ═══════════════════════════════════════════════════════════
   PulseNet Social — styles.css
   Layout: full-screen, left sidebar + right chat column
═══════════════════════════════════════════════════════════ */

/* ── CSS variables ──────────────────────────────────────── */
:root {
  --bg:          #f2efe8;
  --card:        #fffdf9;
  --ink:         #112a46;
  --muted:       #50606f;
  --accent:      #0d8b8b;
  --accent-2:    #f25f4c;
  --line:        #d9d1c5;
  --online:      #17a34a;
  --shadow:      0 18px 45px rgba(17,42,70,.15);
  --msg-bg:      #ffffff;
  --msg-border:  #ddd6cc;
  --chat-bg:     #f7f4ef;
  --compose-bg:  #faf7f2;
  --input-bg:    #ffffff;
  --sidebar-w:   260px;
  --topbar-h:    52px;
}

body.dark {
  --bg:         #0f1117;
  --card:       #1a1d27;
  --ink:        #e8eaf0;
  --muted:      #7a8494;
  --accent:     #0fb8b8;
  --line:       #2a2f3d;
  --online:     #22c55e;
  --shadow:     0 18px 45px rgba(0,0,0,.5);
  --msg-bg:     #22273a;
  --msg-border: #2e3448;
  --chat-bg:    #161921;
  --compose-bg: #1a1d27;
  --input-bg:   #22273a;
}

body.dark {
  background: radial-gradient(circle at 15% 15%,#1a0a2e 0,transparent 35%),
              radial-gradient(circle at 85% 80%,#0a2020 0,transparent 36%), var(--bg);
}

/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Sora", sans-serif;
  background: radial-gradient(circle at 15% 15%,#f8d8ad 0,transparent 35%),
              radial-gradient(circle at 85% 80%,#9bd9d9 0,transparent 36%), var(--bg);
  color: var(--ink);
  overflow: hidden;
}

h1,h2,h3,h4 { font-family: "Space Grotesk", sans-serif; margin: 0; }
input, textarea, button { font: inherit; }

/* ── Background decorations ─────────────────────────────── */
.bg-shape {
  position: fixed;
  width: 360px; height: 360px;
  border-radius: 45% 55% 50% 50%;
  filter: blur(10px);
  z-index: -1;
  opacity: .55;
  animation: drift 18s infinite alternate ease-in-out;
}
.bg-shape-a { top:-100px; left:-90px; background:#f25f4c; }
.bg-shape-b { right:-120px; bottom:-80px; background:#0d8b8b; animation-delay:2.5s; }

@keyframes drift {
  from { transform:translateY(0) rotate(0deg); }
  to   { transform:translateY(24px) rotate(9deg); }
}

/* ── Shared controls ────────────────────────────────────── */
input, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem .9rem;
  background: var(--input-bg);
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); }

button {
  border: none;
  border-radius: 12px;
  padding: .72rem .95rem;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.hidden { display: none !important; }
.muted  { color: var(--muted); font-size: .9rem; margin: 0; }
.status { min-height: 1.2rem; margin: .5rem 0 0; color: var(--accent-2); }

/* ── App shell ──────────────────────────────────────────── */
.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Auth panel ─────────────────────────────────────────── */
.auth-panel {
  max-width: 420px;
  margin: 8vh auto;
  padding: 2.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: fadeIn .5s ease;
}

.tagline { margin: .5rem 0 0; color: var(--muted); }

#authForm { display: grid; gap: .85rem; margin-top: 1rem; }

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

#registerBtn { background: var(--line); color: var(--ink); }
#loginBtn    { background: var(--accent); color: #fff; }

.keep-signed-in {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  margin-top: .1rem;
}

/* Hide native checkbox */
.keep-signed-in input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom toggle track */
.keep-signed-in .toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line);
  border: 1.5px solid var(--msg-border);
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}

/* Thumb */
.keep-signed-in .toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), background .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

/* Checked state */
.keep-signed-in input[type="checkbox"]:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.keep-signed-in input[type="checkbox"]:checked + .toggle-track::after {
  transform: translateX(16px);
  background: #fff;
}

/* ── Chat panel: full screen ────────────────────────────── */
.chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
}

/* ── Top bar ────────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  z-index: 10;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.brand-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .01em;
}

.mobile-menu-btn {
  display: none;
  background: var(--line);
  color: var(--ink);
  padding: .4rem .7rem;
  border-radius: 10px;
  font-size: 1.1rem;
}

/* Back button (mobile only — hidden on desktop) */
.back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: .3rem .5rem;
  border-radius: 10px;
  background: var(--line);
  color: var(--ink);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-right: .35rem;
}

/* ── Layout grid: sidebar + conversation ────────────────── */
.layout-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ── Left sidebar ───────────────────────────────────────── */
aside {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--card);
  min-height: 0;
  overflow: hidden;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: .9rem .85rem;
  min-height: 0;
}

/* Profile row at top of sidebar */
.sidebar-me {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.2rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--line);
}

.welcome-name {
  font-weight: 600;
  font-size: .95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .55rem;
}

.people-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  margin: 0 0 .55rem;
}

.people-view-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  padding: .4rem .5rem;
  font-size: .78rem;
  font-weight: 600;
}

.people-view-btn.active {
  background: var(--line);
  border-color: var(--accent);
}

/* People list */
.users-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .4rem;
}

.user-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .55rem .75rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  overflow: hidden;
  min-width: 0;
}

.user-item:hover, .user-item.active {
  background: var(--line);
  border-color: var(--accent);
}

.user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
  min-width: 0;
}

.user-subline {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}

.user-menu-btn,
.add-friend-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  padding: .3rem .45rem;
  font-size: .72rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-menu-btn:hover,
.add-friend-btn:hover {
  background: var(--line);
}

.empty-people {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: .7rem;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #9da8b5;
  flex-shrink: 0;
}
.dot.online { background: var(--online); }
.dot.offline { background: #e5484d; }

/* Settings footer */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: .8rem .85rem .9rem;
}

.settings-list {
  display: grid;
  gap: .35rem;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  padding: .5rem .65rem;
  font-size: .9rem;
  width: 100%;
  text-align: left;
  transition: background .15s ease;
}
.setting-row:hover:not(:disabled) { background: var(--line); transform: none; }
.setting-icon { font-size: 1rem; line-height: 1; }
.danger-row { color: var(--accent-2); }

/* ── Right conversation ─────────────────────────────────── */
.conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--chat-bg);
}

/* Conversation header */
.conversation-head {
  flex-shrink: 0;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.conv-head-left h3 {
  font-size: 1rem;
  font-weight: 600;
}

.call-status-text {
  font-size: .82rem;
  color: var(--accent);
  margin: .15rem 0 0;
  min-height: .9rem;
}

/* ── Call stage ─────────────────────────────────────────── */
.call-stage {
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: .8rem 1rem;
  gap: .75rem;
  max-height: 55%;
  overflow-y: auto;
}

body.call-active .call-stage { display: flex; }

/* Video grid */
.video-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.video-slot {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  min-height: 160px;
}

.video-slot video {
  width: 100%;
  height: 100%;
  min-height: 160px;
  max-height: 210px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  position: relative;
  z-index: 2;
}

/* When video slot has active video stream, hide the avatar overlay */
.video-slot.has-video .call-av-wrap { display: none; }

/* ── Call avatar overlay ─────────────────────────── */
.call-av-wrap {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  background: linear-gradient(160deg,#0d1b2a 0%,#13262f 100%);
}

.call-av-ring {
  border-radius: 50%;
  padding: 5px;
  background: transparent;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .15s ease, background .15s ease;
}

.call-av-ring.speaking {
  animation: callSpeakPulse 0.7s ease-in-out infinite alternate;
}

@keyframes callSpeakPulse {
  from {
    box-shadow: 0 0 0 3px rgba(13,139,139,.55), 0 0 18px 4px rgba(13,139,139,.3);
  }
  to {
    box-shadow: 0 0 0 6px rgba(13,139,139,.85), 0 0 32px 10px rgba(13,139,139,.5);
  }
}

.call-av-circle {
  width: 80px !important;
  height: 80px !important;
  font-size: 2rem !important;
  border: 3px solid rgba(255,255,255,.18);
  flex-shrink: 0;
}

.call-av-name {
  font-size: .8rem;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  letter-spacing: .04em;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

.video-label {
  position: absolute;
  bottom: .5rem;
  left: .6rem;
  font-size: .72rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,.45);
  padding: .2rem .5rem;
  border-radius: 6px;
  pointer-events: none;
}

/* Audio settings */
.audio-settings {
  display: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--compose-bg);
  padding: .75rem;
}

body.call-active .audio-settings { display: block; }
body.call-active.audio-tuning-autohide .audio-settings { display: none; }

.audio-settings h4 { margin: 0 0 .6rem; font-size: .9rem; }

.audio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.audio-grid label {
  display: grid;
  gap: .3rem;
  font-size: .88rem;
}

.audio-grid span { color: var(--muted); font-size: .82rem; }

.audio-grid input[type="range"] { width: 100%; accent-color: var(--accent); }

.audio-toggles {
  margin-top: .55rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
}

.audio-toggles label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
}

/* Mic meter */
.mic-feedback { margin-top: .6rem; }

.mic-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .35rem;
}

.mic-feedback-row .muted { margin: 0; }

.test-mic-btn {
  flex-shrink: 0;
  font-size: .8rem;
  padding: .3rem .75rem;
  border-radius: 8px;
  background: var(--line);
  color: var(--ink);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.test-mic-btn:hover { background: var(--accent); color: #fff; }
.test-mic-btn.testing { background: #f25f4c; color: #fff; }

.mic-meter {
  border: 1px solid var(--line);
  background: var(--input-bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.mic-level-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0d8b8b 0%, #f2b945 70%, #f25f4c 100%);
  transition: width 100ms linear;
}

/* ── Chat box ───────────────────────────────────────────── */
.chat-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Chat is always visible during a call */
body.call-active .chat-box { display: flex; }

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: .9rem 1rem;
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 0;
}

.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 72%;
  align-self: flex-start;
}

.msg.mine {
  align-items: flex-end;
  align-self: flex-end;
}

.msg .bubble {
  background: var(--msg-bg);
  border: 1px solid var(--msg-border);
  border-radius: 18px 18px 18px 4px;
  padding: .55rem .85rem;
  font-size: .97rem;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.msg.mine .bubble {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  border-radius: 18px 18px 4px 18px;
}

.msg .bubble p   { margin: 0; }
.msg .bubble img { max-width: 220px; border-radius: 10px; display: block; margin-top: .4rem; }
.msg .bubble img.message-image { cursor: zoom-in; }
.msg .bubble video { max-width: 260px; border-radius: 10px; display: block; margin-top: .4rem; }
.msg .bubble audio { width: 220px; margin-top: .4rem; display: block; }
.msg .bubble a   { color: inherit; opacity: .85; }
.msg.mine .bubble a { color: #d4fffc; }

.msg small {
  font-size: .7rem;
  color: var(--muted);
  margin-top: .2rem;
  padding: 0 .3rem;
}

/* Compose */
.message-form {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--compose-bg);
  padding: .5rem .75rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.emoji-picker {
  position: fixed;
  width: min(420px, calc(100vw - 20px));
  max-height: min(56vh, 420px);
  overflow: hidden;
  background: var(--sidebar-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .6rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  z-index: 1000;
  box-sizing: border-box;
  animation: pickerIn .15s ease;
}
@keyframes pickerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
  max-height: min(48vh, 340px);
  overflow-y: auto;
  padding-right: 2px;
}

.emoji-grid::-webkit-scrollbar {
  width: 8px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.emoji-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .4rem;
  padding-top: .3rem;
  border-top: 1px solid var(--line);
}
.emoji-nav-btn {
  background: var(--input-bg);
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  padding: .15rem .55rem;
  cursor: pointer;
  font-weight: 700;
  transition: background .12s;
}
.emoji-nav-btn:hover { background: var(--accent); color: #fff; }
.emoji-nav-btn:disabled { opacity: .35; cursor: default; }
#emojiPageLabel {
  font-size: .8rem;
  min-width: 38px;
  text-align: center;
  color: var(--ink-dim, #888);
}

.compose-icons {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
}

.compose-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  width: 100%;
}

.compose-row textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  border-radius: 12px;
  padding: .6rem .85rem;
  font-size: .95rem;
  min-height: 40px;
  max-height: 120px;
  background: var(--input-bg);
  color: var(--ink);
  overflow-y: auto;
  line-height: 1.45;
  border: 1px solid var(--line);
}
.compose-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,139,139,.1);
}

.clear-input-btn {
  color: var(--ink);
  opacity: .55;
  font-size: .9rem;
}
.clear-input-btn:hover { opacity: 1; background: var(--line); }

#sendBtn {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  padding: .6rem 1.1rem;
  border-radius: 12px;
  font-weight: 600;
}

.compose-icon-btn {
  flex-shrink: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  padding: .3rem .35rem;
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-end;
  margin-bottom: 2px;
}
.compose-icon-btn:hover { background: var(--line); }

.emoji-btn {
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  padding: .42rem;
  border-radius: 8px;
  text-align: center;
}
.emoji-btn:hover { background: var(--line); }

.gif-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  min-width: 34px;
  padding: .35rem .42rem;
  border: 1px solid var(--line);
}

.attach-btn {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  padding: .28rem .32rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}
.attach-btn:hover { background: var(--line); }

/* Attach file preview strip */
.attach-preview {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .3rem .1rem .25rem;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
.attach-preview::-webkit-scrollbar { height: 4px; }
.attach-preview::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.attach-card {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.attach-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-card .attach-name {
  font-size: .6rem;
  color: var(--ink);
  text-align: center;
  padding: 0 4px;
  word-break: break-all;
  line-height: 1.2;
  max-height: 2.6em;
  overflow: hidden;
}
.attach-card .attach-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: .2rem;
}
.attach-card .attach-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .7rem;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.attach-card .attach-remove:hover { background: #c0392b; }

.attach-progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0,0,0,.2);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}
.attach-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .1s linear;
  border-radius: 0 0 10px 10px;
}

.attach-progress-text {
  position: absolute;
  left: 4px;
  bottom: 7px;
  z-index: 2;
  font-size: .62rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.55);
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1.2;
}
.attach-card.attach-done {
  opacity: .5;
  pointer-events: none;
}

/* Drop overlay */
.drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: rgba(13,139,139,.15);
  border: 3px dashed var(--accent);
  z-index: 10;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
  flex-direction: column;
  gap: .5rem;
}
.drop-overlay.active { display: flex; }

.drop-progress-wrap {
  width: min(320px, 78%);
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  overflow: hidden;
  border: 1px solid rgba(13,139,139,.25);
}

.drop-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #31b4d6);
  transition: width .12s linear;
}

.drop-progress-text {
  font-size: .9rem;
  color: var(--ink);
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
}

/* ── Bottom call controls ───────────────────────────────── */

/* Header call button */
.conv-head-actions {
  display: flex;
  gap: .45rem;
  flex-shrink: 0;
}

.head-call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem 1rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .02em;
  min-width: 84px;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 3px 12px rgba(13,139,139,.24);
}
.head-call-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.head-call-btn:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.head-call-label { font-size: .67rem; font-weight: 600; line-height: 1; }
#videoCallBtn { display: none !important; }

/* Call controls bar — hidden by default, slides up during a call */
.call-controls-bar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .55rem .75rem;
  background: var(--card);
  border-top: 1px solid var(--line);
  animation: callBarIn .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes callBarIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

body.call-active .call-controls-bar { display: flex; }

.call-controls-bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  padding: .5rem 1.1rem;
  border-radius: 14px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--line);
  color: var(--ink);
  min-width: 72px;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.call-controls-bar button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.call-controls-bar button:disabled { opacity: .38; cursor: not-allowed; }
.call-controls-bar button .btn-icon { font-size: 1.25rem; line-height: 1; }

/* callChatToggleBtn removed — chat is always visible during calls */

#muteBtn { background: var(--line); color: var(--ink); }
#muteBtn.active { background: var(--accent-2); color: #fff; }
#videoToggleBtn { background: var(--line); color: var(--ink); }
#videoToggleBtn.active { background: var(--accent); color: #fff; }
#flipCameraBtn { background: var(--line); color: var(--ink); }
#flipCameraBtn.active { background: var(--accent); color: #fff; }

#endCallBtn { background: var(--accent-2); color: #fff; }

/* ── Avatars ────────────────────────────────────────────── */
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .88rem;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}
.avatar-circle.sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar-circle.lg { width: 88px; height: 88px; font-size: 2.1rem; }
.avatar-circle img { width:100%; height:100%; object-fit:cover; }

.avatar-btn {
  background: transparent;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}
.avatar-btn:hover:not(:disabled) { transform: scale(1.07); }

/* ── People search bar ──────────────────────────────────── */
.search-wrap {
  margin-bottom: .7rem;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .5rem .75rem;
  font-size: .88rem;
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,139,139,.12);
}

/* ── Incoming call modal ────────────────────────────────── */
.inc-call-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: incOverlayIn .25s ease;
}

@keyframes incOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.inc-call-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 2rem 2.4rem 1.8rem;
  width: 300px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
  animation: incCardIn .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes incCardIn {
  from { opacity:0; transform:scale(.82) translateY(16px); }
  to   { opacity:1; transform:scale(1)   translateY(0); }
}

.inc-call-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.inc-call-ring-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: .25rem 0;
}

.inc-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: incRingPulse 2.2s ease-out infinite;
}
.inc-ring.r1 { animation-delay: 0s; }
.inc-ring.r2 { animation-delay: .7s; }
.inc-ring.r3 { animation-delay: 1.4s; }

@keyframes incRingPulse {
  0%   { transform:scale(1);   opacity:.8; }
  100% { transform:scale(2.2); opacity:0; }
}

.inc-call-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2rem;
  overflow: hidden;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 4px var(--card), 0 0 0 6px var(--accent);
}
.inc-call-avatar img { width:100%; height:100%; object-fit:cover; }

.inc-call-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.inc-call-type {
  font-size: .83rem;
  color: var(--muted);
  margin: 0;
}

.inc-call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  width: 100%;
  margin-top: .4rem;
}

.inc-btn {
  padding: .65rem .5rem;
  border-radius: 14px;
  font-size: .9rem;
  font-weight: 600;
  transition: transform .15s ease, opacity .15s ease;
}
.inc-btn:hover:not(:disabled) { transform: translateY(-2px); }
.inc-btn.accept  { background: var(--online); color: #fff; }
.inc-btn.decline { background: var(--accent-2); color: #fff; }

/* ── Call ended toast ───────────────────────────────────── */
.call-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e2233;
  color: #fff;
  padding: .7rem 1.4rem;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 2000;
  animation: toastIn .25s ease;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity:0; transform:translateX(-50%) translateY(10px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}

/* ── Generic app dialog ─────────────────────────────────── */
.ui-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 1rem;
}

.ui-dialog-card {
  width: min(460px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 22px 70px rgba(0,0,0,.33);
  padding: 1rem;
  display: grid;
  gap: .75rem;
}

.ui-dialog-card h3 {
  margin: 0;
  font-size: 1rem;
}

#uiDialogMessage {
  margin: 0;
  color: var(--ink);
  white-space: pre-line;
  line-height: 1.4;
}

.ui-dialog-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: .9rem;
  background: var(--input-bg);
  color: var(--ink);
}

.ui-dialog-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ui-dialog-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  padding: .45rem .75rem;
  font-size: .83rem;
  font-weight: 600;
}

.ui-dialog-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ui-dialog-btn.danger {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}

/* ── Calling overlay ────────────────────────────────────── */
.calling-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.calling-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
}

.calling-ring-wrap {
  position: relative;
  width: 130px; height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calling-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  animation: pulse-ring 2.4s ease-out infinite;
  opacity: 0;
}
.calling-ring.ring-1 { animation-delay:0s; }
.calling-ring.ring-2 { animation-delay:.8s; }
.calling-ring.ring-3 { animation-delay:1.6s; }

@keyframes pulse-ring {
  0%   { transform:scale(1);   opacity:.85; }
  100% { transform:scale(2.6); opacity:0; }
}

.calling-avatar-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  font-weight: 700;
  color: #fff;
  position: relative;
  z-index: 1;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(255,255,255,.18);
}
.calling-avatar-circle img { width:100%; height:100%; object-fit:cover; }

.calling-card h3 { margin:0; font-size:1.6rem; color:#fff; }
.calling-status  { color:rgba(255,255,255,.6); font-size:.92rem; margin:0; }

#cancelCallBtn {
  background: var(--accent-2);
  color: #fff;
  padding: .72rem 2.6rem;
  border-radius: 999px;
  font-size: .95rem;
}

/* ── Profile modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.6rem;
  min-width: 300px;
  max-width: 90vw;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.3rem;
}
.modal-head h3 { margin:0; }

#closeProfileBtn {
  background: var(--line);
  color: var(--ink);
  padding: .28rem .6rem;
  border-radius: 8px;
  font-size: .85rem;
}

.profile-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.2rem;
}

.upload-avatar-btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: .72rem 1.2rem;
  cursor: pointer;
  font-size: .95rem;
  transition: opacity .2s;
}
.upload-avatar-btn:hover { opacity: .85; }

/* Username change */
.username-change-wrap {
  margin-top: 1.1rem;
  display: grid;
  gap: .4rem;
}
.username-change-label {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.username-change-row {
  display: flex;
  gap: .5rem;
}
.username-change-row input {
  flex: 1;
  border-radius: 12px;
  padding: .55rem .8rem;
  font-size: .93rem;
  border: 1.5px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color .15s;
}
.username-change-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,139,139,.12);
}
.username-change-row #saveUsernameBtn {
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity .15s, transform .15s;
}
.username-change-row #saveUsernameBtn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.username-change-row #saveUsernameBtn:disabled { opacity: .45; cursor: not-allowed; }

.username-change-row #copyUsernameBtn {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: .55rem .9rem;
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, transform .15s;
}
.username-change-row #copyUsernameBtn:hover:not(:disabled) { background: var(--line); transform: translateY(-1px); }
.username-change-row #copyUsernameBtn:disabled { opacity: .45; cursor: not-allowed; }

/* Danger zone */
.danger-zone {
  margin-top: 1.4rem;
  border-top: 1px solid #f25f4c44;
  padding-top: 1rem;
}
.danger-zone-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--accent-2);
  font-size: .82rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin: 0 0 .3rem;
}
.danger-zone-desc { font-size: .88rem; color: var(--muted); margin: 0 0 .7rem; }

#deleteAccountDetails {
  border: 1px solid #f25f4c66;
  border-radius: 12px;
  overflow: hidden;
}
#deleteAccountDetails summary {
  cursor: pointer;
  padding: .62rem .9rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent-2);
  list-style: none;
  user-select: none;
}
#deleteAccountDetails summary::-webkit-details-marker { display:none; }
#deleteAccountDetails[open] summary { border-bottom: 1px solid #f25f4c44; }

.delete-confirm-wrap { padding: .85rem .9rem; display: grid; gap: .6rem; }
.delete-confirm-wrap input { border-radius: 10px; font-size: .92rem; }

#deleteAccountBtn {
  background: var(--accent-2);
  color: #fff;
  border-radius: 10px;
  font-size: .92rem;
  padding: .62rem 1rem;
}

/* ── Responsive: narrow screens (≤ 720px) ───────────────── */
@media (max-width: 720px) {
  :root { --sidebar-w: 100%; }

  /* ── Safe-area padding for iOS notch / home indicator ── */
  .app-shell {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Two "pages": sidebar fills screen, conversation fills screen */
  .layout-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
    overflow: hidden;
  }

  /* Sidebar takes full screen by default */
  aside {
    position: absolute;
    inset: 0;
    border-right: none;
    border-bottom: none;
    display: flex;
    z-index: 5;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    transform: translateX(0);
  }

  /* Conversation: slide in from right when a chat is open */
  .conversation {
    position: absolute;
    inset: 0;
    z-index: 6;
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
  }

  /* body.chat-open shifts views */
  body.chat-open aside { transform: translateX(-100%); }
  body.chat-open .conversation { transform: translateX(0); }

  /* Keep legacy show-people working too */
  .layout-grid.show-people aside { display: flex; }

  /* Back arrow in header replaces hamburger */
  .mobile-menu-btn { display: none; }
  .back-btn { display: flex !important; }

  /* Bigger touch targets throughout */
  .user-item { padding: .75rem; min-height: 56px; }
  .setting-row { min-height: 48px; }
  .compose-icon-btn { min-width: 44px; min-height: 44px; font-size: 1.2rem; }
  #sendBtn { padding: .72rem 1rem; }

  /* Compose textarea: prevent iOS auto-zoom (font-size ≥ 16px) */
  #messageInput { font-size: 16px; }
  input, select { font-size: 16px; }

  /* ── Mobile compose: icons row above textarea+send ── */
  .message-form {
    padding: .4rem .6rem calc(.4rem + env(safe-area-inset-bottom));
    gap: .3rem;
  }
  .compose-row {
    flex-wrap: wrap;
    gap: .4rem;
    align-items: flex-end;
  }
  /* Icons take their own full row at the top */
  .compose-icons {
    order: 0;
    width: 100%;
    gap: .4rem;
    padding-bottom: .1rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .1rem;
  }
  /* Textarea grows to fill remaining space in second row */
  #messageInput {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    max-height: 120px;
    font-size: 16px; /* prevent iOS zoom */
  }
  #clearInputBtn { order: 2; }
  #sendBtn {
    order: 3;
    min-height: 44px;
    padding: .55rem 1.1rem;
    align-self: flex-end;
  }
  /* Icon buttons: bigger tap targets */
  .compose-icon-btn {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.25rem;
  }

  /* Tighter conversation header */
  .conversation-head { padding: .5rem .75rem; gap: .5rem; }
  .conv-head-left { flex: 1; min-width: 0; gap: .4rem; display: flex; align-items: center; }
  .conv-head-left h3 { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .head-call-label { display: none; }
  .head-call-btn { min-width: 72px; min-height: 42px; padding: .5rem .85rem; border-radius: 11px; }

  /* Call stage: stack video slots vertically, limit height */
  .video-wrap {
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }
  .video-slot video { min-height: 110px; max-height: 160px; }
  .call-av-circle { width: 60px !important; height: 60px !important; font-size: 1.5rem !important; }

  .audio-settings { padding: .55rem; }
  .audio-grid { grid-template-columns: 1fr; gap: .45rem; }
  .audio-toggles { grid-template-columns: 1fr 1fr; gap: .3rem; }
  .audio-toggles label { font-size: .82rem; }
  .call-stage { max-height: 52%; padding: .55rem .65rem; }

  /* Call controls bar: larger buttons */
  .call-controls-bar button { font-size: .82rem; padding: .5rem .7rem; }

  /* Auth form: full width, less margin */
  .auth-panel { margin: 4vh 1rem; padding: 1.6rem 1.2rem; }

  /* Top bar compact */
  .top-bar { padding: 0 .75rem; }

  /* Messages: tighter padding */
  .messages { padding: .65rem .75rem; }
  .message-bubble { max-width: 85%; }

  /* Profile modal: full screen sheet */
  .profile-modal {
    align-items: flex-end;
    padding: 0;
  }
  .profile-modal > .modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
    width: 100%;
    max-width: 100%;
    padding: 1.2rem 1.1rem 2rem;
    overflow-y: auto;
  }

  /* Incoming call card */
  .inc-call-card { width: 92vw; }

  /* Emoji picker full-width */
  .emoji-picker { left: 0; right: 0; width: auto; }

  /* Scroll-to-bottom btn: lower on mobile */
  .scroll-down-btn { bottom: 5.5rem; }
}

/* ── Extra small (≤ 390px — iPhone 13 mini / SE) ─────────── */
@media (max-width: 390px) {
  .video-wrap { grid-template-columns: 1fr; }
  .audio-toggles { grid-template-columns: 1fr; }
}

/* ── Read receipt ticks ─────────────────────────────────── */
.msg-status {
  display: inline-block;
  margin-left: .35rem;
  font-size: .75rem;
  color: var(--muted);
  vertical-align: middle;
}
.msg-status::before { content: "✓"; }
.msg-status.read::before { content: "✓✓"; color: var(--accent); }

/* ── Unread badge on sidebar users ──────────────────────── */
.unread-badge {
  background: var(--accent-2);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  animation: badgePop .2s cubic-bezier(.34,1.56,.64,1);
}

@keyframes badgePop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── New messages divider ───────────────────────────────── */
.new-msg-divider {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .6rem 0 .3rem;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.new-msg-divider::before,
.new-msg-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: .35;
}

/* ── Scroll-to-bottom button ────────────────────────────── */
.scroll-down-btn {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .38rem 1rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  z-index: 10;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.scroll-down-btn:hover { opacity: .9; transform: translateX(-50%) translateY(-2px); }

/* ── Ripple effect ──────────────────────────────────────── */
.user-item,
.setting-row,
.head-call-btn,
.call-controls-bar button,
.inc-btn {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0);
  animation: rippleAnim 0.45s ease-out forwards;
  pointer-events: none;
}

body:not(.dark) .user-item .ripple-effect,
body:not(.dark) .setting-row .ripple-effect {
  background: rgba(0, 0, 0, 0.08);
}

@keyframes rippleAnim {
  to { transform: scale(2.8); opacity: 0; }
}

/* ── Image lightbox ────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lbFadeIn .2s ease;
  padding: 1.5rem;
}
.lightbox-overlay.hidden { display: none; }

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-frame {
  position: relative;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 32px 80px rgba(0,0,0,.7);
  overflow: hidden;
  max-width: min(90vw, 900px);
  max-height: 88dvh;
  background: rgba(255,255,255,.04);
  animation: lbScaleIn .22s cubic-bezier(.34,1.56,.64,1);
}

@keyframes lbScaleIn {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-frame img {
  display: block;
  max-width: 100%;
  max-height: 88dvh;
  object-fit: contain;
  border-radius: 16px;
}

.lightbox-close {
  position: fixed;
  top: 1.1rem;
  right: 1.3rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .15s, transform .15s;
  z-index: 3001;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); transform: scale(1.1); }
