/* ── Mirage Messenger — Dark Theme, Telegram-like ── */

:root {
  --bg-primary: #0e0e14;
  --bg-secondary: #17171f;
  --bg-tertiary: #1e1e2a;
  --bg-hover: #252536;
  --bg-active: #2d2d45;
  --surface: #16162266;
  --border: #2a2a3a;
  --text-primary: #eaeaf2;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --accent-light: #6c5ce720;
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --safe-top: constant(safe-area-inset-top, 0px); /* iOS 11.0-11.1 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: constant(safe-area-inset-bottom, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100dvh; width: 100vw; overflow: hidden; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: none; }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-lg { padding: 16px 32px; font-size: 16px; width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%; transition: background 0.2s; color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg-hover); }
.btn-back { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 8px 12px; border-radius: var(--radius-sm); }
.btn-back:hover { color: var(--text-primary); }

.input { width: 100%; padding: 14px 16px; background: var(--bg-tertiary); border: none; border-radius: var(--radius); color: var(--text-primary); font-size: 16px; outline: none; transition: border-color 0.2s; }
.input:focus { box-shadow: 0 0 0 2px var(--accent-light); }
.input::placeholder { color: var(--text-muted); }
.input-group { margin-bottom: 16px; }
.input-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* ── Avatar ── */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; flex-shrink: 0; text-transform: uppercase; }

/* ── Landing ── */
.landing { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at 50% 0%, #1a1a3520 0%, transparent 70%); }
.landing-content { max-width: 420px; width: 100%; text-align: center; }
.landing-logo { margin-bottom: 8px; }
.logo-icon { margin-bottom: 8px; }
.logo-icon svg { display: inline-block; border-radius: 16px; }
.landing-logo h1 { font-size: 48px; font-weight: 800; letter-spacing: -1px; background: linear-gradient(135deg, var(--accent), #a29bfe); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.landing-tagline { font-size: 17px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 40px; }
.landing-features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 40px; }
.feature { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: none; border-radius: var(--radius); font-size: 13px; color: var(--text-secondary); text-align: left; }
.feature-icon { display: flex; align-items: center; justify-content: center; min-width: 32px; color: var(--accent); }
.feature-icon svg { width: 18px; height: 18px; }
.svg-icon { display: inline-flex; align-items: center; justify-content: center; }
.landing-content .btn + .btn { margin-top: 12px; }

/* ── Credentials ── */
.credentials-screen { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.credentials-card { max-width: 440px; width: 100%; background: var(--bg-secondary); border: none; border-radius: var(--radius-lg); padding: 32px; }
.credentials-icon { text-align: center; margin-bottom: 12px; color: var(--accent); }
.credentials-icon svg { width: 48px; height: 48px; }
.credentials-card h2 { text-align: center; margin-bottom: 4px; font-size: 22px; }
.credentials-nickname { text-align: center; font-size: 16px; color: var(--accent); margin-bottom: 8px; font-weight: 600; }
.credentials-warning { text-align: center; font-size: 14px; color: var(--danger); margin-bottom: 24px; line-height: 1.4; }
.credential-row { margin-bottom: 16px; }
.credential-row label { display: block; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.credential-value { padding: 16px; background: var(--bg-primary); border: none; border-radius: var(--radius); font-family: 'SF Mono','Fira Code',monospace; font-size: 18px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: border-color 0.2s; }
.credential-value:hover { box-shadow: 0 0 0 2px var(--accent-light); }
.code-value span:first-child { letter-spacing: 4px; font-size: 24px; font-weight: 700; }
.copy-hint { font-size: 11px; color: var(--text-muted); font-family: system-ui; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin: 24px 0 20px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* ── Login ── */
.login-screen { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { max-width: 400px; width: 100%; background: var(--bg-secondary); border: none; border-radius: var(--radius-lg); padding: 32px; position: relative; }
.login-card h2 { margin: 12px 0 24px; font-size: 24px; }
.btn-close-login {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
  border-radius: 50%; background: var(--bg-tertiary); border: none;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-close-login:hover { background: var(--bg-hover); color: var(--text-primary); }
.login-error { color: var(--danger); font-size: 14px; min-height: 20px; margin-bottom: 4px; }

/* ── Onboarding ── */
.onboarding { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 32px; }
.onboarding-progress { display: flex; gap: 8px; }
.onboarding-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg-hover); transition: all 0.3s; }
.onboarding-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }
.onboarding-dot.done { background: var(--success); }
.onboarding-card { max-width: 380px; width: 100%; text-align: center; }
.onboarding-icon { margin-bottom: 20px; color: var(--accent); }
.onboarding-icon svg { width: 56px; height: 56px; }
.onboarding-card h2 { font-size: 22px; margin-bottom: 12px; }
.onboarding-card p { color: var(--text-secondary); line-height: 1.6; font-size: 15px; margin-bottom: 20px; }
.onboarding-nav { display: flex; gap: 12px; max-width: 380px; width: 100%; }
.onboarding-nav .btn { flex: 1; }

/* ══════════════════════════════════════
   APP LAYOUT (Telegram-like)
   ══════════════════════════════════════ */

.app-container { display: flex; height: 100dvh; padding-top: max(var(--safe-top), env(safe-area-inset-top, 0px)); box-sizing: border-box; }

/* ── Sidebar ── */
.sidebar {
  width: 360px; min-width: 360px;
  display: flex; flex-direction: column;
  background: var(--bg-secondary);
  border-right: none;
  position: relative;
}
.sidebar-header {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: none;
  min-height: 56px;
}
.sidebar-menu-btn { font-size: 18px !important; }
.sidebar-logo { font-size: 20px; font-weight: 800; background: linear-gradient(135deg, var(--accent), #a29bfe); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-search { padding: 8px 12px; }
.search-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-tertiary); border: none; border-radius: 20px;
  color: var(--text-primary); font-size: 14px; outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { box-shadow: 0 0 0 2px var(--accent-light); }

.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.chat-list-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.chat-list-empty .small { font-size: 13px; margin-top: 8px; }

.chat-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.chat-list-item:hover { background: var(--bg-hover); }
.chat-list-item.active { background: var(--accent-light); }
.chat-list-info { flex: 1; min-width: 0; }
.chat-list-top { display: flex; justify-content: space-between; align-items: center; }
.chat-list-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }
.chat-list-bottom { margin-top: 3px; }
.chat-list-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.chat-list-bottom { display: flex; align-items: center; gap: 8px; }
.unread-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--accent);
  color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.code-mono { font-family: monospace; font-size: 12px; }

/* ── FAB ── */
.sidebar-fab { position: absolute; bottom: calc(20px + var(--safe-bottom)); right: 20px; }
.fab {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: white; border: none;
  font-size: 28px; font-weight: 300;
  cursor: pointer;
  box-shadow: 0 4px 16px #6c5ce740;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.fab:hover { background: var(--accent-hover); transform: scale(1.05); }
.fab:active { transform: scale(0.97); }

/* ── Chat Area ── */
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg-primary); min-width: 0; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); }
.chat-empty-icon { margin-bottom: 16px; opacity: 0.25; color: var(--text-muted); }
.chat-empty-icon svg { width: 64px; height: 64px; }
.chat-empty-code { font-size: 14px; margin-top: 8px; cursor: pointer; padding: 8px 16px; border-radius: 20px; background: var(--bg-secondary); border: none; transition: border-color 0.2s; }
.chat-empty-code:hover { box-shadow: 0 0 0 2px var(--accent-light); }

/* ── Chat Header ── */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: none;
  min-height: 56px;
}
.chat-header .avatar { width: 40px; height: 40px; font-size: 16px; }
.chat-header-info { flex: 1; cursor: pointer; }
.chat-header-name { font-size: 16px; font-weight: 600; }
.chat-header-code { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.chat-header-actions { display: flex; gap: 2px; }

/* ── Messages ── */
.messages-container { flex: 1; overflow-y: auto; padding: 12px 20px; display: flex; flex-direction: column; gap: 2px; }

.date-separator {
  text-align: center; padding: 12px 0 8px;
}
.date-separator span {
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.message { display: flex; align-items: flex-end; gap: 6px; }
.message.mine { justify-content: flex-end; }
.message.theirs .avatar { width: 32px; height: 32px; font-size: 13px; margin-bottom: 2px; }

.message-bubble { max-width: 65%; padding: 8px 12px; border-radius: 16px; font-size: 15px; line-height: 1.4; word-break: break-word; }
.mine .message-bubble { background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.theirs .message-bubble { background: var(--bg-tertiary); color: var(--text-primary); border-bottom-left-radius: 4px; }
.message-sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.message-text { white-space: pre-wrap; }
.message-time { font-size: 11px; margin-top: 3px; opacity: 0.55; }
.mine .message-time { text-align: right; }

.file-attachment a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.file-attachment a:hover { text-decoration: underline; }
.file-icon { font-size: 18px; }

.typing-indicator { padding: 2px 20px 6px; font-size: 13px; color: var(--text-muted); font-style: italic; }

/* ── Call Events in Chat ── */
.call-event {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 8px 16px; margin: 8px 0;
  background: var(--bg-secondary); border-radius: 20px;
  font-size: 13px; color: var(--text-secondary);
  max-width: 300px; margin-left: auto; margin-right: auto;
}
.call-event.missed { color: var(--danger); }
.call-event.missed .call-event-icon svg { color: var(--danger); }
.call-event-icon { display: flex; }
.call-event-icon svg { width: 14px; height: 14px; }
.call-event-time { color: var(--text-muted); font-size: 11px; margin-left: auto; }

/* ── Unread separator ── */
.unread-separator {
  text-align: center; padding: 8px 0; position: relative;
}
.unread-separator::before {
  content: ''; position: absolute; left: 16px; right: 16px; top: 50%;
  height: 1px; background: var(--accent);
}
.unread-separator span {
  background: var(--bg-primary);
  padding: 2px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--accent);
  position: relative;
  font-weight: 500;
}

/* ── Image messages ── */
.msg-image {
  max-width: 100%; max-height: 300px; border-radius: 12px; cursor: pointer;
  display: block; object-fit: cover;
}
.msg-image-caption { font-size: 14px; margin-top: 6px; line-height: 1.4; }
.image-viewer {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s;
}
.image-viewer-img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.image-viewer-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px;
  border-radius: 50%; background: rgba(255,255,255,0.15); border: none;
  color: white; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Chat Input ── */
.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: none;
}
.chat-input {
  flex: 1; padding: 11px 16px;
  background: var(--bg-tertiary); border: none; border-radius: 22px;
  color: var(--text-primary); font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { box-shadow: 0 0 0 2px var(--accent-light); }
.chat-input::placeholder { color: var(--text-muted); }
.btn-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: white; border: none;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; flex-shrink: 0;
}
.btn-send:hover { background: var(--accent-hover); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: #000000aa; display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; animation: fadeIn 0.15s; }
.modal { background: var(--bg-secondary); border: none; border-radius: var(--radius-lg); padding: 24px; max-width: 400px; width: 100%; animation: slideUp 0.2s; }
.modal h3 { margin-bottom: 12px; font-size: 18px; }
.modal-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; line-height: 1.4; }
.modal-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

.modal-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.modal-option:hover { background: var(--bg-hover); }
.modal-option-icon { display: flex; align-items: center; justify-content: center; width: 36px; color: var(--accent); }
.modal-option-icon svg { width: 20px; height: 20px; }
.modal-option-label { font-size: 15px; font-weight: 500; }
.modal-option-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Group info ── */
.group-member-list { max-height: 300px; overflow-y: auto; margin: 12px 0; }
.group-member-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.group-member-name { font-size: 14px; font-weight: 500; }
.group-member-role { font-size: 12px; color: var(--accent); }

/* ── Call ── */
.call-overlay { position: fixed; inset: 0; background: var(--bg-primary); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call-audio-screen { text-align: center; }
.call-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; color: var(--accent); margin: 0 auto 20px; }
.call-peer-name { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.call-status { color: var(--text-muted); font-size: 15px; }
.call-remote-video { width: 100%; height: 100%; object-fit: cover; background: black; }
.call-local-video {
  position: absolute; bottom: 100px; right: 16px; width: 110px; height: 150px;
  border-radius: var(--radius); object-fit: cover; z-index: 5;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); touch-action: none;
}
.call-controls { position: absolute; bottom: 40px; left: 0; right: 0; display: flex; justify-content: center; gap: 24px; padding: 0 20px; }
.call-ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.call-ctrl-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: white; transition: background 0.2s;
}
.call-ctrl-icon svg { width: 24px; height: 24px; }
.call-ctrl-btn.active .call-ctrl-icon { background: rgba(255,255,255,0.35); }
.call-ctrl-btn:active .call-ctrl-icon { transform: scale(0.9); }
.call-ctrl-label { font-size: 11px; color: var(--text-muted); }
.call-end-btn .call-ctrl-icon, .call-end-icon { background: var(--danger) !important; }
.call-end-btn .call-ctrl-icon svg { transform: rotate(135deg); }
.call-avatar-wrap { margin-bottom: 20px; }
.call-mute-indicator {
  position: absolute; bottom: 140px; left: 0; right: 0;
  text-align: center; font-size: 13px; color: var(--text-muted);
  padding: 6px 16px;
}
.call-mute-indicator::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); margin-right: 8px; vertical-align: middle;
}
.call-video-status {
  position: absolute; top: max(env(safe-area-inset-top, 20px), 20px); left: 0; right: 0;
  text-align: center; z-index: 2; padding: 12px;
}
.call-video-status .call-peer-name {
  display: inline-block; padding: 8px 20px; border-radius: 24px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 18px; font-weight: 600;
}
.call-video-status .call-status {
  display: inline-block; padding: 4px 14px; border-radius: 12px;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; margin-top: 6px;
}

/* ── Incoming Call Overlay ── */
.incoming-call-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #0a0a1a 0%, #1a1a3a 100%);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s;
}
.incoming-call-content { text-align: center; padding: 24px; }
.incoming-call-pulse {
  width: 120px; height: 120px;
  margin: 0 auto 32px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.incoming-call-pulse::before, .incoming-call-pulse::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--accent);
  animation: callPulse 2s infinite;
}
.incoming-call-pulse::after { animation-delay: 0.6s; }
.incoming-call-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  position: relative; z-index: 1;
}
.incoming-call-label {
  font-size: 14px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: 12px;
}
.incoming-call-name {
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.incoming-call-code {
  font-size: 14px; color: var(--text-muted);
  font-family: monospace; letter-spacing: 2px;
  margin-bottom: 60px;
}
.incoming-call-buttons { display: flex; justify-content: center; gap: 60px; }
.incoming-call-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
}
.incoming-call-btn .call-btn-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; transition: transform 0.2s;
}
.incoming-call-btn .call-btn-icon svg { width: 28px; height: 28px; }
.incoming-call-btn.decline .call-btn-icon svg { transform: rotate(135deg); }
.incoming-call-avatar svg { width: 40px; height: 40px; color: white; }
.incoming-call-btn:active .call-btn-icon { transform: scale(0.9); }
.incoming-call-btn.decline .call-btn-icon { background: var(--danger); }
.incoming-call-btn.accept .call-btn-icon { background: var(--success); }
.incoming-call-btn .call-btn-label { font-size: 13px; color: var(--text-secondary); }

@keyframes callPulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── Toast ── */
.toast { position: fixed; bottom: calc(80px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg-tertiary); border: none; color: var(--text-primary); padding: 10px 20px; border-radius: 24px; font-size: 14px; z-index: 999; opacity: 0; transition: all 0.3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

/* ── Mobile ── */
.mobile-only { display: none; }

@media (max-width: 767px) {
  .sidebar { width: 100%; min-width: 100%; position: absolute; inset: 0; z-index: 10; }
  .sidebar.hidden { display: none; }
  .chat-area { width: 100%; }
  .mobile-only { display: block; }
  .message-bubble { max-width: 82%; }
  .landing-features { grid-template-columns: 1fr; }
}

/* ── Desktop wide ── */
@media (min-width: 1200px) {
  .sidebar { width: 400px; min-width: 400px; }
  .message-bubble { max-width: 55%; }
}

/* ── Admin ── */
.admin-container { max-width: 900px; margin: 0 auto; padding: 24px; padding-top: calc(24px + var(--safe-top)); min-height: 100dvh; }
.admin-container h1 { margin-bottom: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--bg-secondary); border: none; border-radius: var(--radius); padding: 20px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-secondary); border-radius: var(--radius); overflow: hidden; border: none; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 14px; }
.admin-table th { background: var(--bg-tertiary); color: var(--text-secondary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
