/* ═══════════════════════════════════════════════════
   PrivateChat — WhatsApp-style Multi-Connection UI
   Dark/Light Glassmorphism
   ═══════════════════════════════════════════════════ */

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

:root {
  /* DARK THEME (Default) */
  --bg: #0a0a0f;
  --bg-surface: #111118;
  --bg-card: rgba(18, 18, 28, 0.95);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.09);
  --primary: #7C3AED;
  --primary-l: #9D5CF6;
  --primary-glow: rgba(124, 58, 237, 0.3);
  --accent: #06B6D4;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --msg-out-bg: rgba(124, 58, 237, 0.22);
  --msg-out-bd: rgba(124, 58, 237, 0.45);
  --msg-in-bg: rgba(255, 255, 255, 0.055);
  --msg-in-bd: rgba(255, 255, 255, 0.09);
  --text: #f0f0f8;
  --text-muted: #8888a0;
  --text-dim: #50506a;
  --success: #10b981;
  --danger: #ef4444;
  --preview-bg: rgba(20, 20, 30, 0.9);
  --r: 12px;
  --r-lg: 20px;
  --r-xl: 28px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 64px;
}

[data-theme="light"] {
  --bg: #f4f4f8;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --glass: rgba(0, 0, 0, 0.04);
  --glass-border: rgba(0, 0, 0, 0.08);
  --primary: #6D28D9;
  --primary-l: #8B5CF6;
  --primary-glow: rgba(109, 40, 217, 0.2);
  --accent: #0891B2;
  --accent-glow: rgba(8, 145, 178, 0.2);
  --msg-out-bg: #ede9fe;
  --msg-out-bd: #ddd6fe;
  --msg-in-bg: #ffffff;
  --msg-in-bd: #e5e7eb;
  --text: #111827;
  --text-muted: #4b5563;
  --text-dim: #9ca3af;
  --preview-bg: rgba(240, 240, 245, 0.9);
}

html,
body {
  height: 100vh;
  height: 100dvh;
  /* dynamic viewport height — shrinks when mobile keyboard opens */
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* Safari fallback for dynamic viewport height */
@supports (-webkit-touch-callout: none) {

  html,
  body {
    height: -webkit-fill-available;
  }
}

body.static-page-body {
  overflow-y: auto;
}

::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 99px;
}

/* ═══ APP LAYOUT ═════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ═══ SIDEBAR ════════════════════════════════════ */
.sidebar {
  width: 320px;
  min-width: 320px;
  height: 100%;
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), background 0.3s;
  position: relative;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

/* ID Card Section */
.my-id-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.my-id-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.my-id-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.id-reset-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.id-reset-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.1);
}

.my-id-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px dashed var(--glass-border);
}

.my-id-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
  letter-spacing: 0.08em;
  font-family: var(--mono);
}

.inline-share-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.inline-share-btn:hover {
  transform: scale(1.05) translateY(-2px);
}

.my-id-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-l);
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dot.offline {
  background: var(--text-dim);
}

/* New Connection Button */
.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.new-chat-btn:hover {
  transform: scale(1.02);
  filter: brightness(1.11);
  box-shadow: 0 6px 22px var(--primary-glow);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.conv-empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
  padding: 2rem;
}

.conv-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

.online-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 5px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1)
  }

  50% {
    opacity: .5;
    transform: scale(.8)
  }
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.18s var(--ease);
  position: relative;
}

.conv-item:hover {
  background: var(--glass);
}

.conv-item.active {
  background: rgba(124, 58, 237, 0.1);
  border-left-color: var(--primary);
}

.conv-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
}

.conv-avatar-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.conv-avatar-dot.online {
  background: var(--success);
}

.conv-avatar-dot.offline {
  background: var(--text-dim);
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-id {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-last-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.conv-time {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.conv-badge {
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  border-top: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.1);
}

.sidebar-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.sidebar-footer a:hover {
  text-decoration: underline;
}

.danger-link {
  color: var(--danger) !important;
  font-weight: 700 !important;
}

.grad-link {
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  text-decoration: none;
  display: inline-block;
  margin-top: 0.5rem;
}

/* ═══ CHAT PANEL ══════════════════════════════════ */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 500px 400px at 80% 0%, rgba(124, 58, 237, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 400px 400px at 0% 100%, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
  overflow: hidden;
  position: relative;
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.empty-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.15;
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(var(--primary), transparent);
  top: -100px;
  right: -50px;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(var(--accent), transparent);
  bottom: -80px;
  left: -50px;
  animation-delay: -4s;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-20px)
  }
}

.empty-content {
  position: relative;
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.empty-logo svg {
  filter: drop-shadow(0 0 20px var(--primary-glow));
}

.empty-content h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.features-strip {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.features-strip span {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  padding: 0.3rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  backdrop-filter: blur(8px);
}

.home-explainer {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto 4rem;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.home-explainer-header {
  max-width: 760px;
  margin-bottom: 1.6rem;
}

.home-explainer-header h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 2.4vw, 2.5rem);
  color: var(--text);
}

.home-explainer-header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.home-explainer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.home-explainer-card {
  padding: 1.2rem;
  border-radius: var(--r);
  background: rgba(10, 15, 28, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.home-explainer-card h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  color: var(--primary-l);
}

.home-explainer-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.95rem;
}

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-view.hidden {
  display: none;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  min-height: 60px;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-partner-id {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.partner-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.partner-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.partner-badge.offline {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.typing-indicator {
  font-size: 0.7rem;
  color: var(--accent);
  font-style: italic;
  margin-top: 2px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.chat-header-actions {
  display: flex;
  gap: 0.3rem;
}

/* ── Messages Area ── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

.chat-start-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  padding: 2rem;
}

.lock-icon {
  font-size: 1.75rem;
}

.message {
  display: flex;
  max-width: 82%;
  position: relative;
  animation: msgIn 0.22s var(--ease);
  align-items: center;
  gap: 0.5rem;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.97)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.message.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.incoming {
  align-self: flex-start;
  flex-direction: row;
}

/* Reply Button inside Message row */
.msg-reply-btn {
  opacity: 0;
  transition: opacity 0.2s;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.message:hover .msg-reply-btn {
  opacity: 1;
}

.msg-reply-btn:hover {
  background: var(--bg-surface);
  color: var(--primary);
}

.bubble {
  padding: 0.55rem 0.85rem;
  border-radius: var(--r);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.message.outgoing .bubble {
  background: var(--msg-out-bg);
  border: 1px solid var(--msg-out-bd);
  border-bottom-right-radius: 3px;
}

.message.incoming .bubble {
  background: var(--msg-in-bg);
  border: 1px solid var(--msg-in-bd);
  border-bottom-left-radius: 3px;
}

/* Quoted Reply within bubble */
.quote-box {
  background: rgba(0, 0, 0, 0.08);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="light"] .quote-box {
  background: rgba(0, 0, 0, 0.04);
}

.quote-box strong {
  color: var(--primary-l);
  font-size: 0.75rem;
  display: block;
  margin-bottom: 0.1rem;
}

.bubble-time {
  display: block;
  font-size: 0.62rem;
  opacity: 0.5;
  margin-top: 0.2rem;
  text-align: right;
}

/* Media / Files in bubbles */
.bubble img,
.bubble video {
  max-width: min(280px, 100%);
  border-radius: 8px;
  display: block;
  margin-bottom: 0.2rem;
  cursor: pointer;
  border: 1px solid var(--glass-border);
}

.bubble video {
  max-height: 250px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
}

.file-icon {
  font-size: 1.8rem;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.file-size {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.download-btn {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.2s;
}

.download-btn:hover {
  background: var(--primary);
  color: white;
}

.media-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.sys-msg {
  align-self: center;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  padding: 0.3rem 0.9rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Input Area (Previews + Bar) ── */
.input-area-container {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
}

.preview-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--preview-bg);
  border-bottom: 1px solid var(--glass-border);
  animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(10px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.preview-info {
  display: flex;
  flex-direction: column;
}

.preview-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.preview-subtitle {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  position: relative;
}

.emoji-picker-wrap {
  position: absolute;
  bottom: 100%;
  left: 0.75rem;
  margin-bottom: 0.5rem;
  z-index: 100;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  background: var(--bg-surface);
}

emoji-picker {
  height: 300px;
  width: min(330px, calc(100vw - 1.5rem));
  --background: var(--bg-surface);
  --border-color: var(--glass-border);
  --indicator-color: var(--primary);
  --input-border-color: var(--glass-border);
  --input-font-color: var(--text);
  --input-placeholder-color: var(--text-muted);
  --category-font-color: var(--text-muted);
}

.message-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font);
  resize: none;
  outline: none;
  max-height: 110px;
  overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}

.message-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.message-input::placeholder {
  color: var(--text-dim);
}

.send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: var(--r);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 3px 14px var(--primary-glow);
}

.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px var(--primary-glow);
}

/* Icon Buttons */
.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--r);
  transition: all 0.18s;
}

.icon-btn:hover {
  background: var(--glass);
  color: var(--text);
}

.icon-btn-sm {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  border-radius: 6px;
  transition: all 0.18s;
}

.icon-btn-sm:hover {
  background: var(--glass);
  color: var(--text);
}

.icon-btn-sm.danger:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.call-btn {
  color: var(--accent) !important;
}

.call-btn:hover {
  background: rgba(6, 182, 212, 0.1) !important;
}

.danger-btn:hover {
  color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* ═══ MODALS ══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2), 0 0 40px var(--primary-glow);
  position: relative;
  overflow: hidden;
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.connect-input-wrap {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.connect-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  outline: none;
}

.connect-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.connect-status {
  font-size: 0.78rem;
  min-height: 1.1em;
}

.connect-status.success {
  color: var(--success);
}

.connect-status.error {
  color: var(--danger);
}

.connect-status.info {
  color: var(--accent);
}

.btn-primary,
.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 3px 16px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--primary-glow);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.request-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.request-actions button {
  flex: 1;
}

.grad-text {
  background: linear-gradient(90deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mono {
  font-family: var(--mono);
}

/* ═══ MODERN CALL UI (Google Meet / WhatsApp Style) ════════════ */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: #0b141a;
  color: white;
  overflow: hidden;
}

.call-bg-blur {
  position: absolute;
  inset: 0;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-repeat: repeat;
  background-size: 300px;
  opacity: 0.05;
  pointer-events: none;
}

.call-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100%;
}

/* Header UI: Smaller and Floating */
.call-header-ui {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s ease;
}

.call-partner-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #128c7e;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.call-header-ui h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.call-header-ui p {
  font-size: 0.8rem;
  color: #22d3ee;
  margin: 0;
  font-family: var(--mono);
}

/* Main Video Area */
.video-grid {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.video-remote-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-remote-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
}

/* Local Video: Mobile-ready Floating - Like WhatsApp/Google Meet */
.video-local-wrap {
  position: absolute;
  bottom: 6rem;
  right: 1.5rem;
  width: 280px;
  aspect-ratio: 9/16;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  background: #111;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-local-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Controls: Floating Dynamic Bar */
.controls-container {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  width: auto;
  min-width: 300px;
  display: flex;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.controls-container.hide-ui {
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
}

.controls-grid {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(32, 33, 36, 0.9);
  padding: 0.75rem 1.5rem;
  border-radius: 99px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.action-group span {
  display: none;
  /* Hide labels for a cleaner look, use title instead */
}

.call-btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.call-btn-circle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.call-btn-circle.active {
  background: #fff;
  color: #202124;
}

.call-btn-circle.reject,
.call-btn-circle.end-call {
  background: #ea4335;
  width: 52px;
  height: 52px;
}

.call-btn-circle.reject:hover,
.call-btn-circle.end-call:hover {
  background: #d93025;
  transform: scale(1.1);
}

.call-btn-circle.accept {
  background: #0f9d58;
  width: 52px;
  height: 52px;
}

/* Incoming UI: Special handling */
.call-incoming-ui {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
}

.incoming-content {
  text-align: center;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.incoming-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #128c7e;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
  box-shadow: 0 0 50px rgba(18, 140, 126, 0.4);
}

.incoming-actions {
  display: flex;
  gap: 3rem;
  margin-top: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 700px) {
  .call-header-ui {
    top: 1rem;
    left: 1rem;
    right: 1rem;
    justify-content: center;
  }

  .video-local-wrap {
    width: 140px;
    aspect-ratio: 9/16;
    bottom: 5rem;
    right: 1rem;
  }

  .controls-container {
    bottom: 1.5rem;
    width: 90%;
  }

  .controls-grid {
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    width: 100%;
    justify-content: space-around;
  }

  .call-btn-circle {
    width: 44px;
    height: 44px;
  }
}



/* ═══ TOAST ═══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  padding: 0.6rem 1.2rem;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: 0 6px 28px rgba(0, 0, 0, .2);
  z-index: 9999;
  white-space: nowrap;
  transition: opacity .3s;
  pointer-events: none;
}

.toast.success {
  border-color: rgba(16, 185, 129, .4);
  color: var(--success);
}

.toast.error {
  border-color: rgba(239, 68, 68, .4);
  color: var(--danger);
}

/* UTILS & RESPONSIVE */
.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

@media (max-width: 700px) {
  .sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    transform: translateX(0);
    z-index: 20;
  }

  .sidebar.hidden-mobile {
    transform: translateX(-100%);
  }

  /* Mobile: use flex column so input-area always stays visible above keyboard */
  .chat-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Messages area takes remaining space and scrolls */
  .chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .messages-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    /* Left padding kam karo taaki incoming message edge ke paas aaye */
    padding-left: 0.35rem;
  }

  /* Sirf incoming (receiver) message ke liye — zyada left space use na ho */
  .message.incoming {
    max-width: 95%;
  }

  /* Input area stays pinned at bottom and never hides behind keyboard */
  .input-area-container {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
  }

  .mobile-only {
    display: flex;
  }

  .message {
    max-width: 88%;
  }

  .emoji-picker-wrap {
    left: 0;
  }

  .video-local-wrap {
    width: 85px;
  }
}

/* ══════════ PRIVACY MODAL & SLIDER ══════════ */
.privacy-card {
  max-width: 420px;
  padding: 2.5rem 2rem;
  text-align: center;
  border: 1px solid var(--primary-glow);
}

.privacy-header {
  margin-bottom: 1.5rem;
}

.privacy-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 15px var(--primary-glow));
}

.privacy-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.privacy-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.privacy-scroller-box {
  margin: 2rem 0;
  position: relative;
}

.privacy-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.privacy-labels span {
  transition: all 0.3s;
}

.privacy-labels span.active {
  color: var(--primary-l);
  transform: scale(1.1);
}

.privacy-slider {
  width: 100%;
  -webkit-appearance: none;
  background: var(--glass);
  height: 10px;
  border-radius: 99px;
  outline: none;
  border: 1px solid var(--glass-border);
  cursor: pointer;
}

.privacy-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: 4px solid var(--bg-surface);
  box-shadow: 0 0 15px var(--primary-glow);
  transition: transform 0.2s;
}

.privacy-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.privacy-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0 5px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.privacy-desc {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--r);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
}

.w-full {
  width: 100%;
}

/* ══════════ TOP HEADER STYLES ══════════ */
.main-header {
  height: 64px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--glass);
}

.nav-link.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

#main-content-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Page Transitions */
.content-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

.content-view.active {
  display: flex !important;
  animation: viewFadeIn 0.3s var(--ease);
  z-index: 5;
}

.content-view.hidden {
  display: none !important;
  z-index: 1;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Static Content Containers */
.static-content-container {
  width: 95%;
  max-width: 900px;
  margin: 3rem auto 5rem;
  padding: 3rem;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  color: var(--text);
  flex-shrink: 0;
}

.static-content-container h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.usage-step {
  background: var(--glass);
  padding: 1.5rem;
  border-radius: var(--r);
  border: 1px solid var(--glass-border);
  text-align: center;
}

.step-num {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-weight: 800;
}

.real-life-example {
  background: rgba(124, 58, 237, 0.1);
  padding: 2rem;
  border-radius: var(--r);
  border: 1px solid var(--primary-glow);
  margin-bottom: 3rem;
}

.real-life-example h3 {
  margin-bottom: 1rem;
  color: var(--primary-l);
}

.video-placeholder {
  margin-top: 3rem;
}

.video-embed {
  margin: 1.5rem 0;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
}

.policy-section {
  margin-bottom: 2.5rem;
}

.policy-section h2 {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.policy-section p {
  line-height: 1.7;
  color: var(--text-muted);
}

.contact-box {
  text-align: center;
  max-width: 600px;
}

.contact-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.contact-email {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-l);
  margin: 2rem 0;
  text-decoration: none;
  border-bottom: 2px dashed var(--primary-l);
}

.company-footer {
  margin-top: 3rem;
  opacity: 0.8;
}

/* MOBILE ADJUSTMENTS */
@media (max-width: 700px) {
  .main-header {
    height: auto;
    flex-direction: column;
    padding: 0.75rem 1rem;
  }

  .header-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.5rem 0;
    gap: 0.5rem;
  }

  .nav-link {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
  }

  .contact-email {
    font-size: 0.95rem;
    word-break: break-all;
    margin: 1.5rem 0;
  }

  .static-content-container {
    padding: 1.5rem;
    margin: 1rem;
  }

  .home-explainer {
    width: calc(100% - 1.5rem);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .connect-input-wrap {
    flex-direction: column;
    gap: 0.8rem;
  }

  #btn-connect {
    width: 100%;
    justify-content: center;
  }
}

/* ══════════ INFO PAGE MODALS (How to Use / Privacy / Contact) ══════════ */
.info-modal-card {
  max-width: 700px;
  width: 94vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  animation: infoModalIn 0.28s var(--ease);
}

@keyframes infoModalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(6, 182, 212, 0.05));
  backdrop-filter: blur(10px);
}

.info-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-modal-emoji {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.info-modal-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.info-modal-body {
  overflow-y: auto;
  padding: 2rem 1.75rem;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.info-modal-body .usage-grid {
  margin-bottom: 1.5rem;
}

.info-modal-body .policy-section h2 {
  font-size: 1.05rem;
}

.info-modal-tip {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--r);
  padding: 0.9rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 1rem;
}

.info-modal-tip strong {
  color: var(--primary-l);
}

/* Contact Modal center layout */
.info-modal-contact-card .info-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding: 2.5rem 1.75rem;
}

/* Mobile adjustments for info modals */
@media (max-width: 700px) {
  .info-modal-card {
    max-height: 92vh;
    width: 98vw;
  }

  .info-modal-header {
    padding: 1rem 1.2rem;
  }

  .info-modal-body {
    padding: 1.25rem 1rem;
  }

  .info-modal-body .usage-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
