:root {
  --apple-black: #1c1c1e;
  --apple-dark-gray: #f2f2f7;
  --apple-gray-2: #e5e5ea;
  --apple-gray-3: #d1d1d6;
  --apple-light-gray: #e9e9eb;
  
  --system-red: #ff3b30;
  --system-green: #34c759;
  --system-blue: #007aff;
  --system-blue-glow: rgba(0, 122, 255, 0.12);
  
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-input: rgba(0, 0, 0, 0.03);
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-spring: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--apple-dark-gray);
  color: var(--apple-black);
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Ambient Animating Glows */
.bg-glow-1 {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
  z-index: 0;
  pointer-events: none;
  animation: float-glow 20s infinite alternate ease-in-out;
}

.bg-glow-2 {
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(88, 86, 214, 0.07) 0%, rgba(255, 255, 255, 0) 70%);
  z-index: 0;
  pointer-events: none;
  animation: float-glow 25s infinite alternate-reverse ease-in-out;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 20px) scale(1.08); }
}

.app-wrapper {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Login/Username Screen */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 40px 32px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.95);
  transition: var(--transition-spring);
  color: var(--apple-black);
}

.glass-card.active {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.screen-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo-wrapper {
  background: linear-gradient(135deg, var(--system-blue) 0%, #5856d6 100%);
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 10px 20px rgba(0, 122, 255, 0.25);
}

.logo-icon {
  width: 30px;
  height: 30px;
  color: #ffffff;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subtitle {
  color: #8e8e93;
  font-size: 0.88rem;
  line-height: 1.4;
}

.input-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group input {
  width: 100%;
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--apple-black);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  border-color: var(--system-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: var(--system-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #006bde;
  transform: translateY(-1px);
}

/* Dashboard Layout */
.dashboard-container {
  display: none;
  width: 100dvw;
  height: 100dvh;
  max-height: 100dvh;
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: var(--apple-dark-gray); /* Light grey page background */
  padding: 24px;
  box-sizing: border-box;
  gap: 20px;
}

.dashboard-container.active {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 100%;
}

/* Sidebar (Chat list) */
.sidebar {
  width: 340px;
  flex-shrink: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
  transition: var(--transition-smooth);
}

.sidebar-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.sidebar-body-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--system-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status {
  font-size: 0.72rem;
  color: #8e8e93;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--system-green);
  border-radius: 50%;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #8e8e93;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--apple-black);
}

.search-bar {
  padding: 12px 16px;
}

.search-input-wrapper {
  display: flex;
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 2px 4px 2px 12px;
  align-items: center;
  gap: 8px;
}

.search-icon {
  width: 16px;
  color: #8e8e93;
}

.search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 0;
  color: var(--apple-black);
  font-size: 0.85rem;
}

#add-room-btn {
  background: transparent;
  border: none;
  color: var(--system-blue);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

#add-room-btn:hover {
  background: rgba(0, 122, 255, 0.15);
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-list-empty {
  padding: 24px;
  text-align: center;
  color: #8e8e93;
  font-size: 0.8rem;
  line-height: 1.4;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chat-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.chat-item.active {
  background: rgba(0, 122, 255, 0.08);
  border-left: 3px solid var(--system-blue);
  border-radius: 0 12px 12px 0;
}

.chat-item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--apple-gray-2);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--system-blue);
}

.chat-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.unread-badge {
  background: var(--system-blue);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

.chat-item.unread {
  background: rgba(0, 122, 255, 0.04);
}

.chat-item.unread:hover {
  background: rgba(0, 122, 255, 0.07);
}

.chat-item.unread .chat-item-name {
  font-weight: 700;
  color: var(--apple-black);
}

.chat-item.unread .chat-item-preview {
  color: #3a3a3c;
  font-weight: 500;
}

.chat-item-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.chat-item-preview {
  font-size: 0.75rem;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Chat window area */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.05);
}

/* Empty State */
.chat-empty-state {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.chat-empty-state.active {
  display: flex;
}

.empty-icon {
  width: 56px;
  height: 56px;
  color: #2c2c2e;
}

.chat-empty-state h3 {
  font-weight: 600;
  font-size: 1.15rem;
}

.chat-empty-state p {
  font-size: 0.85rem;
  color: #8e8e93;
  max-width: 280px;
  line-height: 1.4;
}

/* Chat Active Content */
.chat-content {
  display: none;
}

.chat-content.active {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

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

.chat-title-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

#chat-partner-status {
  font-size: 0.72rem;
  color: #8e8e93;
}

.call-trigger-btn {
  background: var(--system-blue);
  border: none;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.call-trigger-btn:hover {
  background: #006bde;
  transform: scale(1.02);
}

.call-trigger-btn.danger {
  background: rgba(255, 59, 48, 0.1);
  color: var(--system-red);
  border: 1px solid rgba(255, 59, 48, 0.15);
}

.call-trigger-btn.danger:hover {
  background: var(--system-red);
  color: #ffffff;
  transform: scale(1.02);
}

.call-trigger-btn i {
  width: 14px;
  height: 14px;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Delete message hover trash trigger */
.delete-msg-trigger {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.45);
  transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.delete-msg-trigger:hover {
  color: var(--system-red);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%) scale(1.1);
}

.message-bubble.incoming .delete-msg-trigger {
  right: -36px;
}

.message-bubble.outgoing .delete-msg-trigger {
  left: -36px;
}

.message-bubble:hover .delete-msg-trigger {
  opacity: 1;
}

.icon-btn.danger-hover:hover {
  color: var(--system-red);
  background: rgba(255, 59, 48, 0.15);
}

.message-bubble.incoming {
  background: var(--apple-light-gray);
  color: var(--apple-black);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.message-bubble.outgoing {
  background: var(--system-blue);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-sender {
  font-size: 0.72rem;
  font-weight: 700;
  color: #007aff;
  margin-bottom: 2px;
}

.message-bubble.outgoing .msg-sender {
  color: rgba(255, 255, 255, 0.75);
}

.msg-text {
  word-break: break-word;
}

.msg-time {
  font-size: 0.65rem;
  color: #8e8e93;
}

.message-bubble.incoming .msg-time {
  color: rgba(0, 0, 0, 0.45);
}

.message-bubble.outgoing .msg-time {
  color: rgba(255, 255, 255, 0.65);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-end;
  margin-top: 2px;
}

.msg-status {
  display: inline-flex;
  align-items: center;
}

.msg-status i {
  width: 13px;
  height: 13px;
}

.msg-status.sent {
  color: rgba(0, 0, 0, 0.3);
}

.message-bubble.outgoing .msg-status.sent {
  color: rgba(255, 255, 255, 0.55);
}

.msg-status.read {
  color: #30d158; /* Apple System Green for read receipts */
}

.message-input-bar {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
}

.message-input-bar input {
  flex: 1;
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 12px 18px;
  color: var(--apple-black);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
}

.message-input-bar input:focus {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--system-blue);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.send-btn {
  background: var(--system-blue);
  border: none;
  color: #ffffff;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 !important;
  box-sizing: border-box !important;
  transition: var(--transition-smooth);
}

.send-btn i,
.send-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.send-btn:hover {
  transform: scale(1.05);
}

/* FaceTime Style Call Overlay (Can float or take full screen) */
.call-overlay-container {
  display: none;
  position: fixed;
  z-index: 100;
  background: #000000;
  transition: var(--transition-smooth);
}

/* Maximized full screen (Default on mobile) */
.call-overlay-container.maximized {
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* Minimized floating block on PC */
.call-overlay-container.minimized {
  display: flex;
  flex-direction: column;
  width: 360px;
  height: 480px;
  bottom: 84px;
  right: 24px;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.call-overlay-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

.call-timer-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(28, 28, 30, 0.45);
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--system-green);
  border-radius: 50%;
  animation: status-pulse 1.5s infinite;
}

@keyframes status-pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.icon-btn-small {
  background: rgba(28, 28, 30, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.05);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Video Grid inside Call Overlay */
.video-grid-workspace {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

.video-box {
  background: var(--apple-dark-gray);
  position: relative;
}

.remote-box {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#remote-video-blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(28px) brightness(0.45);
  transform: scale(1.15); /* Предотвращает белые рамки по краям из-за размытия */
  z-index: 1;
  pointer-events: none;
}

#remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: var(--apple-dark-gray);
  color: #8e8e93;
  z-index: 3;
}

.pulsing-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--apple-gray-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 1px solid rgba(255,255,255,0.05);
  animation: pulse-avatar-glow 2s infinite ease-in-out;
}

@keyframes pulse-avatar-glow {
  0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.15); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 16px rgba(0, 122, 255, 0); }
  100% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(0, 122, 255, 0); }
}

.video-placeholder p {
  font-size: 0.85rem;
}

/* Local floating PIP */
.local-box {
  position: absolute;
  bottom: 96px;
  right: 20px;
  width: 110px;
  height: 165px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 5;
  cursor: grab;
}

.local-box:active {
  cursor: grabbing;
}

.local-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
  transform: rotateY(180deg);
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  z-index: 3;
}

/* Audio Level Waves */
.mini-visualizer {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px;
  border-radius: 4px;
}

.mini-visualizer span {
  display: block;
  width: 2px;
  height: 2px;
  background: var(--system-green);
  border-radius: 1px;
}

/* Call Control Dock */
.call-controls-dock {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 10;
  pointer-events: none;
}

.dock-circle-btn {
  background: rgba(30, 30, 32, 0.85);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255,255,255,0.06);
  color: #ffffff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition-smooth);
}

.dock-circle-btn:hover {
  transform: translateY(-2px);
  background: #2c2c2e;
}

.dock-circle-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.dock-circle-btn.active:hover {
  background: rgba(255, 255, 255, 0.85);
}

.dock-circle-btn.danger {
  background: var(--system-red);
  color: #ffffff;
  border-color: var(--system-red);
}

.dock-circle-btn.danger:hover {
  background: #e02b20;
}

.dock-circle-btn i {
  width: 18px;
  height: 18px;
}

/* Device Config Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  width: 90%;
  max-width: 400px;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: var(--apple-black);
}

.modal-card.delete-card {
  max-width: 360px;
  text-align: center;
}

.modal-card.delete-card .modal-header {
  justify-content: center;
}

.modal-description {
  color: #8e8e93;
  font-size: 0.9rem;
  line-height: 1.5;
}

.vertical-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.vertical-actions .btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--system-red);
  color: #ffffff;
}

.btn-danger:hover {
  background: #e02b20;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--apple-gray-2);
  border: 1px solid var(--glass-border);
  color: var(--apple-black);
}

.btn-secondary:hover {
  background: var(--apple-gray-3);
  transform: translateY(-1px);
}

.btn-muted {
  background: transparent;
  color: #8e8e93;
}

.btn-muted:hover {
  color: var(--apple-black);
  background: rgba(0, 0, 0, 0.04);
}

.settings-group input {
  width: 100%;
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--apple-black);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-smooth);
}

.settings-group input:focus {
  border-color: var(--system-blue);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8e8e93;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-group label i {
  width: 14px;
  height: 14px;
}

.settings-group select {
  background: var(--glass-input);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--apple-black);
  font-size: 0.88rem;
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-wrapper {
  position: fixed;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: var(--apple-black);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 300;
  transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-wrapper.show {
  top: 24px;
}

#toast-icon {
  width: 16px;
  height: 16px;
}

/* Mobile responsive helper classes */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex !important;
  }
  
  .dashboard-container.active {
    padding: 0 !important;
    gap: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--apple-dark-gray) !important;
  }
  
  /* Show either sidebar or chat list */
  .sidebar {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--apple-dark-gray) !important;
    gap: 0 !important;
  }
  
  .sidebar-header {
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    box-shadow: none !important;
    background: var(--glass-bg) !important;
  }
  
  .sidebar-body-card {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  
  .dashboard-container.chat-active .sidebar {
    display: none !important;
  }
  
  .chat-window {
    display: none;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--apple-dark-gray) !important;
  }
  
  .dashboard-container.chat-active .chat-window {
    display: flex !important;
  }
  
  .chat-empty-state {
    display: none !important;
  }
  
  .messages-container {
    padding: 16px;
  }
  
  .message-bubble {
    max-width: 85%;
  }
  
  /* Full screen overlay calls on mobile always */
  .call-overlay-container.minimized {
    width: 100% !important;
    height: 100% !important;
    bottom: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
  }

  .call-trigger-btn span {
    display: none;
  }

  .call-trigger-btn {
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    justify-content: center;
  }

  .message-input-bar {
    padding: 12px 16px;
    background: var(--glass-bg) !important;
    border-top: 1px solid var(--glass-border) !important;
  }

  .chat-header {
    padding: 12px 16px;
    background: var(--glass-bg) !important;
    border-bottom: 1px solid var(--glass-border) !important;
  }
}

/* Authentication Toggle Styles */
.auth-toggle-wrapper {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #8e8e93;
  display: flex;
  justify-content: center;
  gap: 6px;
  align-items: center;
}

.text-link-btn {
  background: transparent;
  border: none;
  color: var(--system-blue);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-size: 0.85rem;
}

.text-link-btn:hover {
  text-decoration: underline;
}

/* User Directory Search Results */
.search-bar {
  position: relative;
}

.search-results-overlay {
  position: absolute;
  top: 52px;
  left: 16px;
  right: 16px;
  background: var(--apple-dark-gray);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
}

.search-results-overlay.active {
  display: flex;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Incoming Call Card styling */
.incoming-call-card {
  background: var(--glass-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 40px 32px;
  width: 90%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
  animation: scale-up-card 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scale-up-card {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.caller-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.caller-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--system-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 25px rgba(0, 122, 255, 0.3);
  animation: pulse-avatar-glow 1.8s infinite;
}

.incoming-actions {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.incoming-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.incoming-btn i {
  width: 22px;
  height: 22px;
}

.incoming-btn.decline {
  background: var(--system-red);
}

.incoming-btn.decline:hover {
  background: #e02b20;
  transform: scale(1.05);
}

.incoming-btn.accept {
  background: var(--system-green);
  animation: pulse-green-btn 1.5s infinite;
}

.incoming-btn.accept:hover {
  background: #2cb04d;
  transform: scale(1.05);
}

@keyframes pulse-green-btn {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.header-actions {
  display: flex;
  gap: 4px;
}

/* Emoji Picker Styles */
.emoji-picker-container {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.emoji-trigger-btn {
  background: transparent;
  border: none;
  color: #8e8e93;
  cursor: pointer;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0 !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.emoji-trigger-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--apple-black);
}

.emoji-trigger-btn i {
  width: 20px;
  height: 20px;
}

.emoji-picker-popover {
  position: absolute;
  bottom: 56px;
  left: 0;
  width: 320px;
  max-height: 260px;
  background: rgba(21, 21, 23, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  display: none;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  overflow-y: auto;
  z-index: 1000;
  animation: fadeInPopover 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Scrollbar styling for emoji picker */
.emoji-picker-popover::-webkit-scrollbar {
  width: 6px;
}

.emoji-picker-popover::-webkit-scrollbar-track {
  background: transparent;
}

.emoji-picker-popover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.emoji-picker-popover::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.emoji-picker-popover.active {
  display: grid;
}

.emoji-item {
  font-size: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  user-select: none;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.15);
}

@media (max-width: 768px) {
  .emoji-picker-popover {
    width: 280px;
    bottom: 52px;
  }
}

