/* ════════════════════════════════════════
   Wave Messenger — Stylesheet
   ════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --bg-primary: #0f0f18;
  --bg-secondary: #161622;
  --bg-tertiary: #1e1e2e;
  --bg-card: #1a1a28;
  --bg-hover: #222236;
  --bg-bubble-out: #5b4cdb;
  --bg-bubble-in: #222236;
  --text-primary: #eeeef2;
  --text-secondary: #8e8eaa;
  --text-tertiary: #5a5a72;
  --accent: #5b4cdb;
  --accent-light: #8b7fff;
  --accent-glow: rgba(91, 76, 219, 0.25);
  --green: #00c48c;
  --red: #ff5c5c;
  --orange: #ffb347;
  --border: rgba(255,255,255,0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 40px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.25);
  --font: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
}
#app { height: 100vh; width: 100%; }

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

/* ── Auth ── */
.auth-screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
  padding: 20px;
}
.auth-card {
  position: relative;
  z-index: 1;
  margin-bottom: 60px;
}
@media (max-width: 520px) {
  .auth-screen {
    align-items: flex-start;
    padding: 30px 12px 80px;
  }
  .auth-card {
    margin-bottom: 70px;
    width: 100%;
  }
  .auth-card .auth-logo {
    width: 56px; height: 56px;
    border-radius: 16px;
    font-size: 24px;
    margin-bottom: 14px;
  }
  .auth-card .auth-title { font-size: 22px; }
  .auth-card .auth-subtitle { font-size: 13px; margin-bottom: 20px; }
  .consent-checkbox {
    padding: 9px 10px !important;
    font-size: 11px !important;
    border-radius: 10px !important;
    gap: 8px !important;
  }
  .consent-checkmark {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    border-radius: 5px !important;
  }
  .consent-checkbox input:checked + .consent-checkmark::after {
    width: 5px !important;
    height: 9px !important;
  }
  .consent-text { font-size: 11px !important; }
  .consent-group {
    margin: 12px 0 16px !important;
    gap: 6px !important;
  }
  .auth-ip-footer {
    font-size: 9px !important;
    padding: 6px 12px !important;
    gap: 3px !important;
    bottom: 8px !important;
    border-radius: 10px !important;
    flex-direction: column;
    text-align: center;
    white-space: normal;
    max-width: 85vw;
  }
  .ip-footer-divider { display: none; }
  .ip-footer-line svg { width: 11px; height: 11px; }
  .phone-region-select {
    min-width: 80px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
  }
  .phone-number-input {
    font-size: 14px !important;
  }
}
.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.orb1 {
  width: 500px; height: 500px;
  background: var(--accent-glow);
  top: -150px; right: -150px;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb2 {
  width: 350px; height: 350px;
  background: rgba(0,196,140,0.12);
  bottom: -100px; left: -100px;
  animation: orbFloat 15s ease-in-out infinite reverse;
}
.orb3 {
  width: 400px; height: 400px;
  background: rgba(139,127,255,0.1);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat 18s ease-in-out infinite 3s;
}

/* Particles canvas */
.auth-particles-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Animated auth background */
.auth-screen {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(91,76,219,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,127,255,0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 80%, rgba(0,196,140,0.06) 0%, transparent 40%),
    linear-gradient(135deg, #070712 0%, #0d0d1e 30%, #12122a 60%, #0a0a16 100%);
  animation: authBgShift 20s ease-in-out infinite;
}
@keyframes authBgShift {
  0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%; }
  33% { background-position: 30% 20%, 80% 40%, 20% 80%, 0% 0%; }
  66% { background-position: 60% 40%, 30% 60%, 80% 40%, 0% 0%; }
}

/* ИП footer */
.auth-ip-footer {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  font-size: 11px;
  color: var(--text-tertiary);
  z-index: 2;
  white-space: nowrap;
  animation: fadeInUp 1s ease 0.5s both;
}
.ip-footer-line {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ip-footer-line svg { opacity: 0.45; flex-shrink: 0; }
.ip-footer-line span { letter-spacing: 0.3px; }
.ip-footer-divider {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Phone input with region selector */
.phone-input-row {
  display: flex;
  gap: 8px;
  position: relative;
}
.phone-region-select {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  min-width: 100px;
  height: 47px;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}
.phone-region-select:hover { border-color: var(--accent); background: var(--bg-hover); }
.phone-region-select svg { color: var(--text-tertiary); }
.phone-number-input {
  flex: 1;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-mono) !important;
  font-size: 16px !important;
  letter-spacing: 1px;
}

/* Region dropdown */
.region-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  min-width: 260px;
  animation: popIn 0.2s ease;
}
.region-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
}
.region-option:hover { background: var(--bg-hover); }
.region-option-flag { font-size: 18px; }
.region-option-name { flex: 1; color: var(--text-primary); font-weight: 500; }
.region-option-code { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 12px; }

/* Consent checkbox */
.consent-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
  user-select: none;
  padding: 12px 14px;
  background: rgba(91,76,219,0.06);
  border: 1.5px solid rgba(91,76,219,0.15);
  border-radius: 12px;
  transition: all 0.25s;
}
.consent-checkbox:hover {
  background: rgba(91,76,219,0.1);
  border-color: rgba(91,76,219,0.3);
}
.consent-checkbox input:checked ~ .consent-text {
  color: var(--text-primary);
}
.consent-checkbox input { display: none; }
.consent-checkmark {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid rgba(91,76,219,0.4);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.consent-checkbox:hover .consent-checkmark {
  border-color: var(--accent);
}
.consent-checkbox input:checked + .consent-checkmark {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(91,76,219,0.4);
}
.consent-checkbox input:checked + .consent-checkmark::after {
  content: '';
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.consent-text {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s;
}
.consent-text a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
}
.consent-text a:hover { text-decoration: underline; }
.consent-group {
  margin: 18px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.consent-shake {
  animation: consentShake 0.5s ease;
}
.consent-highlight {
  border-color: rgba(255,92,92,0.6) !important;
  background: rgba(255,92,92,0.08) !important;
  box-shadow: 0 0 16px rgba(255,92,92,0.2);
}
.consent-highlight .consent-checkmark {
  border-color: #ff5c5c !important;
  box-shadow: 0 0 8px rgba(255,92,92,0.3);
}
@keyframes consentShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(40px, 25px) scale(1.15); }
}
.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 38px;
  width: 420px;
  max-width: 92vw;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow);
  animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
}
.auth-logo {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px;
  font-weight: 700;
  color: white;
  box-shadow: 0 8px 28px var(--accent-glow);
}
.auth-title {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}
.auth-input-group { margin-bottom: 18px; }
.auth-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 7px;
}
.auth-input {
  width: 100%;
  padding: 13px 15px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-input::placeholder { color: var(--text-tertiary); }
.auth-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.auth-btn:active { transform: translateY(0); }
.auth-btn-disabled {
  background: var(--bg-tertiary) !important;
  color: var(--text-tertiary) !important;
  cursor: not-allowed !important;
  opacity: 0.5;
}
.auth-btn-disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}
.auth-btn-mts {
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.auth-btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.auth-btn-secondary:hover { background: var(--bg-hover); box-shadow: none; }

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.25s ease;
}
.auth-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(91,76,219,0.3);
}
.auth-tab:not(.active):hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.auth-divider {
  text-align: center;
  margin: 16px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-error {
  background: rgba(255,92,92,0.1);
  border: 1px solid rgba(255,92,92,0.2);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  margin-bottom: 14px;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.auth-toggle {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.auth-toggle span { color: var(--accent-light); cursor: pointer; font-weight: 500; }
.auth-toggle span:hover { text-decoration: underline; }
.auth-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
}
.auth-hint strong { color: var(--accent-light); font-family: var(--font-mono); }
.sms-code {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
}
.sms-digit {
  width: 52px; height: 58px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: var(--transition);
}
.sms-digit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ── Main Layout ── */
.main-layout { display: flex; height: 100vh; }
.sidebar {
  width: 380px;
  min-width: 380px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.sidebar-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sidebar-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-shrink: 0;
  white-space: nowrap;
}
.sidebar-actions { display: flex; gap: 2px; align-items: center; flex-wrap: nowrap; }
.icon-btn {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Profile button in header */
.profile-btn-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.profile-btn-header:hover {
  background: var(--bg-hover);
}
.profile-btn-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-btn-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font);
}
.search-bar { position: relative; }
.search-bar svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}
.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-tertiary); }
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: rgba(91,76,219,0.12); }
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.avatar-wrap { position: relative; }
.online-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  background: var(--green);
  border-radius: 50%;
  border: 2.5px solid var(--bg-secondary);
}
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.chat-item-name { font-size: 15px; font-weight: 600; }
.chat-item-time { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }
.chat-item-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.check-icon { color: var(--accent-light); font-size: 11px; }
.unread-badge {
  min-width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  padding: 0 6px;
  flex-shrink: 0;
}

/* ── Chat Area ── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}
.chat-area-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-tertiary);
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 40%, rgba(91,76,219,0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 60%, rgba(139,127,255,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(91,76,219,0.05) 0%, transparent 70%);
}
.chat-area-empty::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91,76,219,0.15) 0%, rgba(139,127,255,0.05) 40%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: emptyPulse 6s ease-in-out infinite;
}
.chat-area-empty::after {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  border: 1px solid rgba(91,76,219,0.08);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: emptyRing 10s linear infinite;
}
@keyframes emptyPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}
@keyframes emptyRing {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0.3; }
  50% { transform: translate(-50%, -50%) scale(1.15) rotate(180deg); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(360deg); opacity: 0.3; }
}
.logo-big {
  width: 110px; height: 110px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  color: white;
  box-shadow: 0 16px 50px rgba(91,76,219,0.4), 0 0 80px rgba(91,76,219,0.15);
  animation: logoBounce 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes logoBounce {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 16px 50px rgba(91,76,219,0.4), 0 0 80px rgba(91,76,219,0.15); }
  50% { transform: translateY(-10px) scale(1.06); box-shadow: 0 24px 70px rgba(91,76,219,0.5), 0 0 120px rgba(91,76,219,0.2); }
}
.chat-area-empty > div, .chat-area-empty > span {
  position: relative;
  z-index: 1;
}
.empty-title {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #a78bfa, #60a5fa);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: emptyTitleShimmer 4s ease-in-out infinite;
}
@keyframes emptyTitleShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.empty-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 66px;
  flex-shrink: 0;
  z-index: 10;
}
.back-btn { display: none !important; }
.chat-header-info { flex: 1; }
.chat-header-name { font-size: 17px; font-weight: 600; }
.chat-header-status { font-size: 12px; color: var(--green); font-weight: 500; }
.chat-header-status.offline { color: var(--text-tertiary); }
.chat-header-actions { display: flex; gap: 4px; }

/* Messages */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.date-divider {
  text-align: center;
  padding: 14px 0 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.msg-row {
  display: flex;
  animation: msgIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg-row.out { justify-content: flex-end; }
.msg-row.in { justify-content: flex-start; }
.msg-bubble {
  max-width: 62%;
  padding: 11px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15.5px;
  word-break: break-word;
  position: relative;
}
.msg-row.out .msg-bubble {
  background: linear-gradient(135deg, #5b4cdb, #7c6cf0);
  border-bottom-right-radius: 4px;
  color: white;
  border: 1px solid rgba(139,127,255,0.3);
  box-shadow: 0 2px 12px rgba(91,76,219,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.msg-row.in .msg-bubble {
  background: linear-gradient(135deg, #1e1e32, #252542);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}
.msg-time {
  font-size: 11px;
  opacity: 0.55;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.msg-check { font-size: 11px; }
.msg-image img {
  max-width: 260px;
  max-height: 200px;
  border-radius: 12px;
  display: block;
  cursor: pointer;
}

/* Voice */
.voice-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}
.voice-play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.msg-row.out .voice-play-btn { background: rgba(255,255,255,0.2); color: white; }
.msg-row.in .voice-play-btn { background: var(--accent); color: white; }
.voice-waves {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
}
.voice-bar { width: 3px; border-radius: 2px; }
.msg-row.out .voice-bar { background: rgba(255,255,255,0.4); }
.msg-row.in .voice-bar { background: var(--accent-light); }
.voice-duration { font-size: 12px; opacity: 0.7; flex-shrink: 0; }

/* Typing */
.typing-indicator {
  padding: 4px 20px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* ── Input ── */
.input-area {
  padding: 10px 20px 14px;
  background: #1e1e2e;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.input-actions { display: flex; gap: 2px; padding-bottom: 3px; }
.input-wrapper { flex: 1; position: relative; }
.input-field {
  width: 100%;
  padding: 11px 16px;
  background: #262640;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-tertiary); }
.send-btn {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.send-btn:hover { transform: scale(1.06); box-shadow: 0 4px 16px var(--accent-glow); }
.mic-btn.recording {
  background: linear-gradient(135deg, var(--red), #ee5a24);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,92,92,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(255,92,92,0); }
}

/* Voice recording overlay — WhatsApp style */
.voice-record-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 20;
  animation: fadeIn 0.15s ease;
  border-top: 1px solid var(--border);
}
.voice-rec-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.voice-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5c5c;
  animation: voiceDotPulse 1s ease-in-out infinite;
}
@keyframes voiceDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.voice-rec-timer {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.voice-rec-center {
  flex: 1;
  text-align: center;
}
.voice-rec-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  animation: voiceHintSlide 1.5s ease-in-out infinite;
}
@keyframes voiceHintSlide {
  0%, 100% { opacity: 0.5; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(-8px); }
}
.voice-rec-right {
  flex-shrink: 0;
}
.voice-rec-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  color: var(--text-tertiary);
  animation: voiceLockBounce 1.5s ease-in-out infinite;
}
@keyframes voiceLockBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.voice-rec-cancel-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,92,92,0.15);
  color: #ff5c5c;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.voice-rec-cancel-btn:hover { background: rgba(255,92,92,0.3); }
.voice-rec-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.voice-rec-send-btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease;
  z-index: 10;
}
@keyframes popIn { from { opacity: 0; transform: translateY(6px); } }
.emoji-btn {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}
.emoji-btn:hover { background: var(--bg-hover); transform: scale(1.15); }
.image-preview-bar {
  padding: 8px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Call Modal ── */
.call-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(24px);
}
.call-modal-video {
  background: #000;
  backdrop-filter: none;
  justify-content: flex-start;
}
.call-avatar {
  width: 110px; height: 110px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  animation: callPulse 2s infinite;
}
.call-avatar-float {
  width: 100px; height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: white;
  animation: callPulse 2s infinite;
}
@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 28px rgba(91,76,219,0); }
}
.call-name { font-size: 26px; font-weight: 700; }
.call-status { font-size: 14px; color: var(--text-secondary); margin-top: 6px; margin-bottom: 44px; }
.call-actions { display: flex; gap: 20px; align-items: center; }

/* Video call fullscreen */
.call-video-fullscreen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 0;
  background: #111;
  overflow: hidden;
}
.call-video-fullscreen video,
.call-video-fullscreen #remoteVideo {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
}
.call-video-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  z-index: 1;
}

/* Local camera PiP */
.call-local-pip {
  position: absolute;
  top: 80px;
  right: 12px;
  width: 100px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  z-index: 12;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  background: #222;
}

/* Top bar — name + timer */
.call-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top, 10px));
  z-index: 15;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
}
.call-top-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.call-top-btn:hover { background: rgba(255,255,255,0.25); }
.call-top-info {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.call-top-name {
  font-size: 15px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-top-status {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 1px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.call-top-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Bottom bar — call controls */
.call-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  z-index: 15;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
}

/* Round call buttons */
.call-btn-round {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
  background: rgba(80,80,80,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.call-btn-round.small {
  width: 50px;
  height: 50px;
}
.call-btn-round:hover { background: rgba(100,100,100,0.8); transform: scale(1.05); }
.call-btn-round:active { transform: scale(0.95); }
.call-btn-round.end {
  background: #ff3b30;
  width: 60px;
  height: 60px;
}
.call-btn-round.end:hover { background: #ee2a20; transform: scale(1.08); }
.call-btn-round.accept {
  background: #34c759;
  width: 60px;
  height: 60px;
}
.call-btn-round.accept:hover { background: #2db84e; transform: scale(1.08); }
.call-btn-active {
  background: var(--accent) !important;
  box-shadow: 0 0 12px rgba(91,76,219,0.4);
}
.call-modal > * { position: relative; z-index: 1; }

/* Minimized call (PiP) */
.call-minimized {
  width: 140px !important;
  height: 200px !important;
  top: auto !important;
  bottom: 80px !important;
  right: 12px !important;
  left: auto !important;
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  cursor: pointer;
}
.call-minimized .call-top-bar,
.call-minimized .call-bottom-bar,
.call-minimized .call-local-pip { display: none !important; }
.call-minimized .call-video-fullscreen { border-radius: 14px; }

/* ── New Chat Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(8px);
}
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 400px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { overflow-y: auto; padding: 8px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.user-row:hover { background: var(--bg-hover); }
.user-row-info { flex: 1; }
.user-row-name { font-size: 14px; font-weight: 500; }
.user-row-phone { font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}
.status-dot.online { background: var(--green); }

/* ── Admin Panel ── */
.admin-panel {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } }
.admin-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.admin-header h2 {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.admin-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.admin-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.admin-tab.active { background: var(--accent); color: white; }
.admin-tab:hover:not(.active) { color: var(--text-primary); }
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.user-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.user-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.user-table td { padding: 10px 14px; font-size: 13px; background: var(--bg-card); }
.user-table tr td:first-child { border-radius: 8px 0 0 8px; }
.user-table tr td:last-child { border-radius: 0 8px 8px 0; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
}
.status-badge.online { background: rgba(0,196,140,0.1); color: var(--green); }
.status-badge.offline { background: rgba(126,126,154,0.1); color: var(--text-secondary); }
.status-badge.banned { background: rgba(255,92,92,0.1); color: var(--red); }
.table-btn {
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-right: 4px;
}
.table-btn.danger { background: rgba(255,92,92,0.1); color: var(--red); }
.table-btn.danger:hover { background: rgba(255,92,92,0.2); }
.table-btn.warn { background: rgba(255,179,71,0.1); color: var(--orange); }
.table-btn.warn:hover { background: rgba(255,179,71,0.2); }
.admin-msg-row {
  padding: 8px 12px;
  border-left: 2px solid var(--bg-tertiary);
  margin-bottom: 6px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
.admin-msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 3px;
  color: var(--text-secondary);
}
.admin-msg-meta strong { color: var(--text-primary); font-size: 13px; }
.admin-msg-content { font-size: 13px; color: var(--text-secondary); }

/* ── Toast ── */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20,20,35,0.95);
  border: 1px solid rgba(91,76,219,0.3);
  padding: 16px 32px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 500;
  color: white;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 20px rgba(91,76,219,0.15);
  z-index: 200;
  text-align: center;
  max-width: 80vw;
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s ease, toastOut 0.4s ease 2.3s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } }

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-width: 100%; }
  .sidebar.hidden { display: none; }
  .chat-area.hidden { display: none; }
  .back-btn { display: flex !important; }
  .msg-bubble { max-width: 80%; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
}
html,body,.main-layout{height:100dvh}
.messages-area{min-height:0;flex:1;-webkit-overflow-scrolling:touch}
@media(max-width:768px){
  .input-area{padding:8px 10px;padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}
  .messages-area{padding:10px 12px}
}
.modal-content { max-height: 85vh; overflow-y: auto; }
.modal-body { overflow-y: auto; max-height: 70vh; }
.dots-btn { opacity: 0.5; }
.dots-btn:hover { opacity: 1; }
@media (max-width: 768px) {
  .dots-btn { opacity: 0.7; }
}
.modal-content { max-height: 85vh; overflow-y: auto; }
.modal-body { overflow-y: auto; max-height: 70vh; }
.dots-btn { opacity: 0.5; }
.dots-btn:hover { opacity: 1; }
@media (max-width: 768px) {
  .dots-btn { opacity: 0.7; }
}
.my-profile-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 6px 6px 2px;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(91,76,219,0.12), rgba(139,127,255,0.08));
  border: 1px solid rgba(91,76,219,0.2);
  transition: all .2s;
}
.my-profile-bar:hover {
  background: linear-gradient(135deg, rgba(91,76,219,0.2), rgba(139,127,255,0.12));
}
.my-profile-bar .my-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.my-profile-bar .my-status {
  font-size: 12px;
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item {
  border: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 4px;
}
.chat-item:hover {
  border-color: rgba(91,76,219,0.2);
}
.chat-item.active {
  border-color: rgba(91,76,219,0.3);
}
.chat-item {
  border: 1px solid rgba(91,76,219,0.25) !important;
  margin-bottom: 4px;
}
.messages-area {
  background-image: 
    radial-gradient(ellipse at 20% 80%, rgba(91,76,219,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,127,255,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0,196,140,0.02) 0%, transparent 60%);
  background-color: var(--bg-primary);
  background-size: 100% 100%;
  position: relative;
}
.messages-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%235b4cdb' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.messages-area > * {
  position: relative;
  z-index: 1;
}
.messages-area {
  background: 
    radial-gradient(ellipse at 15% 85%, rgba(91,76,219,0.15) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(139,127,255,0.1) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(0,196,140,0.05) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%235b4cdb' fill-opacity='0.07'%3E%3Cpath d='M20 20.5V18H18v2.5h-2.5V22H18v2.5h2V22h2.5v-1.5H20z'/%3E%3C/g%3E%3C/svg%3E"),
    var(--bg-primary) !important;
}
.messages-area {
  background:
    radial-gradient(circle at 10% 90%, rgba(91,76,219,0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(91,76,219,0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(30,30,50,0.5) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='50' cy='50' r='1' fill='%235b4cdb' fill-opacity='0.08'/%3E%3Ccircle cx='10' cy='30' r='0.8' fill='%238b7fff' fill-opacity='0.06'/%3E%3Ccircle cx='80' cy='70' r='0.6' fill='%235b4cdb' fill-opacity='0.05'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #0a0a12 0%, #0d0d1a 50%, #0a0a12 100%) !important;
}
.messages-area {
  background:
    linear-gradient(rgba(7,7,12,0.92), rgba(7,7,12,0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'%3E%3Cdefs%3E%3CradialGradient id='a' cx='300' cy='300' r='300' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%235b4cdb' stop-opacity='.15'/%3E%3Cstop offset='1' stop-color='%23070712' stop-opacity='0'/%3E%3C/radialGradient%3E%3CradialGradient id='b' cx='150' cy='450' r='200' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%238b7fff' stop-opacity='.1'/%3E%3Cstop offset='1' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect fill='%23070712' width='600' height='600'/%3E%3Ccircle fill='url(%23a)' cx='300' cy='300' r='300'/%3E%3Ccircle fill='url(%23b)' cx='150' cy='450' r='200'/%3E%3Cpath d='M100 200 Q200 100 300 200 T500 200' stroke='%235b4cdb' stroke-opacity='.06' fill='none' stroke-width='1'/%3E%3Cpath d='M50 350 Q200 250 350 350 T600 350' stroke='%238b7fff' stroke-opacity='.05' fill='none' stroke-width='1'/%3E%3Cpath d='M0 500 Q150 400 300 500 T600 500' stroke='%235b4cdb' stroke-opacity='.04' fill='none' stroke-width='1'/%3E%3Ccircle cx='80' cy='120' r='2' fill='%238b7fff' opacity='.2'/%3E%3Ccircle cx='520' cy='80' r='1.5' fill='%235b4cdb' opacity='.25'/%3E%3Ccircle cx='400' cy='180' r='1' fill='%238b7fff' opacity='.15'/%3E%3Ccircle cx='180' cy='380' r='1.8' fill='%235b4cdb' opacity='.2'/%3E%3Ccircle cx='450' cy='420' r='1.2' fill='%238b7fff' opacity='.18'/%3E%3Ccircle cx='300' cy='550' r='1.5' fill='%235b4cdb' opacity='.15'/%3E%3Ccircle cx='550' cy='300' r='2' fill='%238b7fff' opacity='.12'/%3E%3Ccircle cx='50' cy='520' r='1' fill='%235b4cdb' opacity='.2'/%3E%3C/svg%3E") !important;
  background-size: cover !important;
  background-position: center !important;
}
.messages-area {
  background: #131322 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><rect width='400' height='400' fill='%23131322'/><circle cx='50' cy='80' r='80' fill='%23222244' opacity='0.4'/><circle cx='350' cy='320' r='100' fill='%23212140' opacity='0.35'/><circle cx='200' cy='200' r='150' fill='%231a1a38' opacity='0.3'/><circle cx='80' cy='300' r='3' fill='%235b4cdb' opacity='0.5'/><circle cx='320' cy='60' r='2.5' fill='%238b7fff' opacity='0.4'/><circle cx='200' cy='150' r='2' fill='%235b4cdb' opacity='0.35'/><circle cx='150' cy='350' r='1.8' fill='%238b7fff' opacity='0.45'/><circle cx='370' cy='200' r='2.2' fill='%235b4cdb' opacity='0.3'/><circle cx='40' cy='180' r='1.5' fill='%238b7fff' opacity='0.5'/><circle cx='280' cy='280' r='1.8' fill='%235b4cdb' opacity='0.4'/><circle cx='100' cy='50' r='1.2' fill='%238b7fff' opacity='0.35'/><circle cx='300' cy='380' r='2' fill='%235b4cdb' opacity='0.45'/><circle cx='250' cy='100' r='1.5' fill='%238b7fff' opacity='0.3'/><path d='M0 250 Q100 200 200 250 T400 250' stroke='%235b4cdb' stroke-width='0.5' fill='none' opacity='0.15'/><path d='M0 150 Q150 100 300 150 T400 120' stroke='%238b7fff' stroke-width='0.5' fill='none' opacity='0.1'/></svg>") repeat !important;
  background-size: 400px 400px !important;
}
.messages-area {
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

/* ── Verified Badge ── */
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
}

.verified-badge svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.5));
  animation: verifiedPulse 3s ease-in-out infinite;
}

.verified-badge-lg {
  width: 26px;
  height: 26px;
}

.verified-badge-lg svg {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
}

@keyframes verifiedPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(96, 165, 250, 0.4)); }
  50% { filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.8)) drop-shadow(0 0 20px rgba(139, 92, 246, 0.3)); }
}

.chat-item-name .verified-badge svg,
.chat-header-name .verified-badge svg {
  width: 20px;
  height: 20px;
}

/* Admin verify button */
.table-btn.verify {
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.2);
}
.table-btn.verify:hover {
  background: rgba(96, 165, 250, 0.2);
}
.table-btn.verify.active {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.4);
}

/* ── Admin Animated Name ── */
.admin-name-glow {
  font-weight: 800;
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #a78bfa, #60a5fa);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: adminNameShimmer 4s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(124, 92, 224, 0.3));
}

@keyframes adminNameShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.chat-header-name .admin-name-glow {
  font-weight: 800;
}

.profile-admin-name {
  font-weight: 800;
  background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6, #a78bfa, #60a5fa);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: adminNameShimmer 4s ease-in-out infinite;
  font-size: 22px;
}

/* ── Premium Gold Name ── */
.premium-name-glow {
  font-weight: 700;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #f9a825, #fcd34d, #f59e0b);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: premiumNameShimmer 4s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.25));
}

.profile-premium-name {
  font-weight: 700;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #f9a825, #fcd34d, #f59e0b);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: premiumNameShimmer 4s ease-in-out infinite;
  font-size: 20px;
}

@keyframes premiumNameShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── MoonChat System Name (Green) ── */
.system-name-glow {
  font-weight: 800;
  background: linear-gradient(90deg, #34d399, #10b981, #6ee7b7, #10b981, #34d399);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: systemNameShimmer 4s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.3));
}

.profile-system-name {
  font-weight: 800;
  background: linear-gradient(90deg, #34d399, #10b981, #6ee7b7, #10b981, #34d399);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: systemNameShimmer 4s ease-in-out infinite;
  font-size: 22px;
}

@keyframes systemNameShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Admin premium button */
.table-btn.premium {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.table-btn.premium:hover {
  background: rgba(245, 158, 11, 0.2);
}
.table-btn.premium.active {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Drawing Canvas */
.draw-btn { opacity: 0.7; }
.draw-btn:hover { opacity: 1; }
.draw-color {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.draw-color.active {
  border-color: white;
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}
.draw-color:hover { transform: scale(1.15); }

/* Payment success animations */
@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Status bar — Telegram-style horizontal circles above chat list */
.status-bar {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.status-bar::-webkit-scrollbar { display: none; }

/* WhatsApp-style "Add status" row */
.status-add-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}
.status-add-avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.status-add-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  border: 2px solid transparent;
}
.status-add-avatar-has {
  border: 2px solid var(--green);
}
.status-add-plus-badge {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  border: 2px solid var(--bg-secondary);
  cursor: pointer;
  transition: transform 0.15s;
}
.status-add-plus-badge:hover { transform: scale(1.15); }
.status-add-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.status-add-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.status-add-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.status-add-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.status-add-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(91,76,219,0.12);
  border: none;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.status-add-action-btn:hover {
  background: rgba(91,76,219,0.22);
  transform: scale(1.08);
}
.status-add-action-btn:active { transform: scale(0.95); }

/* Story circles row (others' statuses) */
.status-circles-row {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.status-circles-row::-webkit-scrollbar { display: none; }

.status-circle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.status-circle-wrap:hover { transform: scale(1.05); }
.status-circle-wrap:active { transform: scale(0.95); }

.status-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 3px;
  position: relative;
}
.status-ring-new { border: 3px solid var(--green); }
.status-ring-seen { border: 3px solid rgba(255,255,255,0.15); }
.status-ring-admin { border: 3px solid var(--accent); box-shadow: 0 0 10px rgba(91,76,219,0.25); }
.status-circle-add { border: 3px dashed rgba(255,255,255,0.2); }
.status-circle-add:hover { border-color: var(--accent); }

.status-circle-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  overflow: hidden;
}
.status-circle-plus {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  border: 2px solid var(--bg-secondary);
}
.status-circle-name {
  font-size: 10px;
  color: var(--text-tertiary);
  max-width: 72px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.status-circle-name .verified-badge {
  width: 13px;
  height: 13px;
  margin-left: 1px;
}
.status-circle-name .verified-badge svg {
  width: 13px;
  height: 13px;
}
.status-circle-name .admin-name-glow,
.status-circle-name .premium-name-glow {
  font-size: 10px;
}

/* Status reply bar (WhatsApp-style) */
.status-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}
.status-reply-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: all 0.2s;
}
.status-reply-input::placeholder {
  color: rgba(255,255,255,0.4);
}
.status-reply-input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.12);
}
.status-reply-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.status-reply-send:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* Create status colors */
.status-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.status-color-btn:hover { transform: scale(1.15); }
.status-color-btn.active { border-color: white; transform: scale(1.1); }

/* Visibility buttons */
.vis-btn {
  padding: 6px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}
.vis-btn:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }
.vis-btn.active {
  background: rgba(91,76,219,0.2);
  border-color: var(--accent);
  color: var(--accent-light, #a78bfa);
}

/* Mobile call button fixes */
@media (max-width: 768px) {
  .call-bottom-bar {
    gap: 10px;
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  }
  .call-btn-round { width: 52px; height: 52px; }
  .call-btn-round.small { width: 46px; height: 46px; }
  .call-btn-round.end { width: 56px; height: 56px; }
  .call-btn-round.accept { width: 56px; height: 56px; }
  .call-btn-round svg { width: 20px; height: 20px; }
  .call-local-pip { width: 90px; height: 120px; top: 70px; right: 10px; border-radius: 12px; }
  .call-top-bar { padding: 8px 10px; }
  .call-top-btn { width: 32px; height: 32px; }
  .call-top-name { font-size: 14px; }
}

/* Desktop video call — centered max size */
@media (min-width: 769px) {
  .call-modal-video {
    background: #000;
  }
  .call-local-pip {
    width: 180px;
    height: 240px;
    bottom: 120px;
    right: 24px;
    top: auto;
    border-radius: 16px;
  }
}

/* MoonVPN banner at bottom of sidebar */
.vpn-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 4px 8px 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(91,76,219,0.12), rgba(139,127,255,0.06));
  border: 1px solid rgba(91,76,219,0.18);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
}
.vpn-banner:hover {
  background: linear-gradient(135deg, rgba(91,76,219,0.2), rgba(139,127,255,0.12));
  border-color: rgba(91,76,219,0.3);
  transform: translateY(-1px);
}
.vpn-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91,76,219,0.15);
  border-radius: 12px;
}
.vpn-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-light);
}
.vpn-banner-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
