/**
 * AVChat Styles - Clean messaging and video calling interface
 * Mobile-first responsive design
 */

/* ============================================================================
   VARIABLES & RESETS
   ============================================================================ */

:root {
  --primary-bg: #1a1a2e;
  --secondary-bg: #16213e;
  --tertiary-bg: #0f3460;
  --accent-color: #e94560;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #707080;
  --border-color: #2a2a3e;
  --hover-bg: #2a2a3e;
  --message-sent: #0084ff;
  --message-received: #2a2a3e;
  --online-status: #44b700;
  --offline-status: #707080;
  --scrollbar-track: #16213e;
  --scrollbar-thumb: #0f3460;
  --glass-nav-bg: rgba(26, 26, 46, 0.9);
  --glass-blur: blur(10px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

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

html {
  height: 100%;
  /* overflow:hidden removed — body.whatsapp-style handles scroll lock */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
}

/* Layout lock for the AVChat page.
   Specificity 0,1,1 — same as call-platform.css's body.whatsapp-style rule,
   but avchat.css loads after so this wins for every conflicting property.
   Overrides: background:#dadbd2 → dark theme, position:relative → fixed (iOS scroll lock) */
body.whatsapp-style {
  background-color: var(--primary-bg);
  height: 100dvh;
  overflow: hidden;
  position: fixed;   /* prevents iOS Safari rubber-band scroll */
  width: 100%;
  top: 0;
  left: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--tertiary-bg);
}

/* Toast Notifications */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ============================================================================
   TOP NAVIGATION
   ============================================================================ */

.top-nav {
  background: var(--glass-nav-bg);
  backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Fixed keeps the nav anchored on mobile — sticky is unreliable on iOS Safari
     when the parent has overflow:hidden */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  height: 56px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 15px;
  max-width: 400px;
  flex: 1;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  margin-left: 8px;
  transition: opacity 0.2s;
}

.search-bar button:hover {
  opacity: 0.7;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(79, 172, 254, 0.18);
  border: 1px solid rgba(79, 172, 254, 0.45);
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.2);
  z-index: 10002;
}

.mobile-menu-btn:hover {
  background: rgba(79, 172, 254, 0.3);
  border-color: rgba(79, 172, 254, 0.7);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
  transform: scale(1.05);
}

.mobile-menu-btn.active {
  background: rgba(79, 172, 254, 0.25);
  border-color: rgba(79, 172, 254, 0.7);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .search-bar {
    display: none;
  }
  
  .logo {
    font-size: 18px;
  }
  
  .top-nav {
    padding: 8px 12px;
  }
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: var(--glass-nav-bg-light);
  backdrop-filter: var(--glass-blur-light);
  border: var(--glass-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
}

.nav-btn:hover {
  background: linear-gradient(135deg, rgba(45, 55, 72, 0.95) 0%, rgba(26, 32, 44, 0.95) 100%);
  border-color: var(--glass-border-hover);
  transform: scale(1.1);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e41e3f;
  color: #fff;
  border-radius: 10px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: bold;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
}

.user-menu {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--glass-nav-bg);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  display: none;
  z-index: 10010;
  overflow: hidden;
}

.user-dropdown.active {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-primary);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
}

.dropdown-item:hover {
  background-color: var(--hover-bg);
}

.dropdown-item.logout-btn {
  color: #e41e3f;
}

.user-avatar {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-color);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1.5px solid rgba(79, 172, 254, 0.3);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(79, 172, 254, 0.1);
}

.mobile-menu-toggle.active {
  background: rgba(79, 172, 254, 0.2);
}

/* Hamburger icon lines */
.hamburger-line {
  position: relative;
  z-index: 1;
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
  background: #00f2fe;
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
  background: #00f2fe;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Desktop Navigation Sidebar / Mobile Menu */
.desktop-nav-container {
  position: fixed;
  left: -100%;
  top: 0;
  height: 100vh;
  height: 100dvh;  /* progressive enhancement — keyboard-safe on mobile */
  width: 280px;
  background: linear-gradient(135deg, rgba(45, 55, 72, 0.98) 0%, rgba(26, 32, 44, 0.98) 100%);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease;
  z-index: 10000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.desktop-nav-container.active {
  left: 0;
}

.mobile-menu-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.sidebar-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0;
}

.sidebar-header-nav h2 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.mobile-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s;
}

.mobile-close-btn:hover {
  transform: rotate(90deg);
}

.mobile-menu-section {
  margin-bottom: 10px;
}

.mobile-menu-section h4 {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding: 0;
}

.mobile-menu-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: none;
  background: transparent;
  color: white;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
}

.mobile-menu-item:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.1);
  transform: translateX(4px);
}

.mobile-menu-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
  font-weight: 600;
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.menu-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.menu-text {
  font-size: 15px;
}

.user-info-sidebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  margin-top: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

.user-avatar-sidebar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.user-info-text h4 {
  margin: 0;
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.user-info-text p {
  margin: 4px 0 0 0;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ============================================================================
   MAIN LAYOUT
   ============================================================================ */

/* .avchat-container kept for backward-compat; .whatsapp-container is the live class */
.whatsapp-container,
.avchat-container {
  display: flex;
  position: relative;          /* anchor for absolutely-positioned mobile sidebar */
  width: 100%;
  overflow: hidden;
  /* Fill viewport below the fixed nav.
     100dvh accounts for mobile soft keyboard shrinking the viewport.
     margin: resets call-platform.css's margin:0 auto (would center on wide screens) */
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  margin: 56px 0 0;            /* top=below fixed nav, left/right=0 (not auto) */
}

/* ============================================================================
   CONTACTS SIDEBAR
   ============================================================================ */

.contacts-sidebar {
  width: 360px;
  background-color: var(--secondary-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.search-container {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
}

.search-input {
  width: 100%;
  padding: 10px 15px;
  background-color: var(--tertiary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent-color);
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.contact-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border-color);
}

.contact-item:hover {
  background-color: var(--hover-bg);
}

.contact-item.active {
  background-color: var(--hover-bg);
  border-left-color: var(--accent-color);
}

.contact-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.contact-status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--secondary-bg);
  background-color: var(--offline-status);
}

.contact-status-indicator.online {
  background-color: var(--online-status);
}

.contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-details {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s;
}

.contact-item:hover .contact-actions {
  opacity: 1;
}

.contact-action-btn {
  padding: 6px 12px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.contact-action-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.contact-action-btn:active {
  transform: translateY(0);
}

.contact-item .contact-details {
  flex: 1;
  min-width: 0;
}

.contact-item .contact-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-item .last-message {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-item .message-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.contact-item .timestamp {
  font-size: 12px;
  color: var(--text-muted);
}

.contact-item .unread-badge {
  background-color: var(--accent-color);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 14px;
}

/* ============================================================================
   CHAT VIEW
   ============================================================================ */

.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--primary-bg);
  position: relative;
}

/* No Chat Selected State */
.no-chat-selected {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--text-muted);
}

.no-chat-selected svg {
  opacity: 0.3;
}

.no-chat-selected h3 {
  font-size: 20px;
  color: var(--text-secondary);
}

.no-chat-selected p {
  font-size: 14px;
}

/* Active Chat */
.active-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Chat Header */
.chat-header {
  padding: 15px 20px;
  background-color: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 70px;
}

.chat-header .contact-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
}

.chat-header .avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
}

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

.chat-header .contact-details h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header .status {
  font-size: 13px;
  color: var(--text-muted);
}

.chat-header .status.online {
  color: var(--online-status);
}

.chat-actions {
  display: flex;
  gap: 10px;
}

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

.message {
  display: flex;
  gap: 10px;
  max-width: 70%;
  animation: messageSlideIn 0.2s ease-out;
}

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

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

.message.received {
  align-self: flex-start;
}

.message .message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message .message-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.message .message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  word-wrap: break-word;
  word-break: break-word;
}

.message.sent .message-bubble {
  background-color: var(--message-sent);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
  background-color: var(--message-received);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message .message-time {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 5px;
}

.message.sent .message-time {
  text-align: right;
}

/* Date Divider */
.date-divider {
  text-align: center;
  margin: 10px 0;
  position: relative;
}

.date-divider span {
  background-color: var(--tertiary-bg);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 15px;
  border-radius: 12px;
}

/* Typing Indicator */
.typing-indicator {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Message Input Area */
.message-input-area {
  padding: 15px 20px;
  background-color: var(--secondary-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.input-wrapper {
  flex: 1;
  background-color: var(--tertiary-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
}

.message-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 100px;
  font-family: inherit;
}

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

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

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

.btn-icon:active {
  transform: scale(0.95);
}

.btn-send {
  background-color: var(--accent-color);
  border: none;
  color: white;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-send:not(:disabled):hover {
  opacity: 0.9;
}

.btn-send:not(:disabled):active {
  transform: scale(0.95);
}

/* ============================================================================
   VIDEO CALL OVERLAY
   ============================================================================ */

.call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--primary-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.call-header {
  padding: 20px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.call-header h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.call-header #callDuration {
  font-size: 14px;
  color: var(--text-secondary);
}

.video-grid {
  flex: 1;
  position: relative;
  background-color: #000;
}

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

.local-video {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.call-controls {
  padding: 30px;
  display: flex;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.btn-call {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background-color: var(--secondary-bg);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.2s;
}

.btn-call:hover {
  background-color: var(--tertiary-bg);
}

.btn-call:active {
  transform: scale(0.95);
}

.btn-call.active {
  background-color: var(--accent-color);
}

.btn-end-call {
  background-color: #d32f2f;
}

.btn-end-call:hover {
  background-color: #b71c1c;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
  background-color: var(--secondary-bg);
  border-radius: 16px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  animation: slideUp 0.3s ease-out;
}

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

.modal-header h3 {
  font-size: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.modal-body {
  text-align: center;
  padding: 20px 0;
}

.caller-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 20px;
}

.modal-body h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.modal-body p {
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

.btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: scale(0.98);
}

.btn-decline {
  background-color: var(--tertiary-bg);
  color: var(--text-primary);
}

.btn-accept {
  background-color: var(--online-status);
  color: white;
}

/* ============================================================================
   RESPONSIVE - MOBILE
   ============================================================================ */

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
  }
  
  /* Hide search bar on mobile */
  .search-bar {
    display: none;
  }
  
  /* Hide desktop nav buttons on mobile */
  .desktop-nav .nav-btn {
    display: none;
  }
  
  /* Keep user avatar visible */
  .desktop-nav .user-menu {
    display: flex;
  }
  
  /* Contact actions always visible on mobile */
  .contact-actions {
    opacity: 1;
  }
  
  .contact-action-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
  
  .contacts-sidebar {
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    transition: transform 0.3s ease-out;
  }
  
  .contacts-sidebar.hidden {
    transform: translateX(-100%);
  }
  
  .chat-view {
    width: 100%;
  }
  
  .active-chat {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  
  .mobile-only {
    display: flex;
  }
  
  .message {
    max-width: 85%;
  }
  
  .local-video {
    width: 120px;
    height: 90px;
    bottom: 100px;
    right: 10px;
  }
  
  .call-controls {
    padding: 20px;
    gap: 15px;
  }
  
  .btn-call {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .sidebar-header {
    padding: 15px;
  }
  
  .sidebar-header h2 {
    font-size: 20px;
  }
  
  .search-container {
    padding: 12px 15px;
  }
  
  .contact-item {
    padding: 12px 15px;
  }
  
  .chat-header {
    padding: 12px 15px;
  }
  
  .messages-container {
    padding: 15px;
  }
  
  .message-input-area {
    padding: 12px 15px;
  }
}

/* ============================================================================
   CALL MODALS
   ============================================================================ */

/* Active Call Modal */

/* Active Call Modal */
.active-call-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 10003;
  display: flex;
  flex-direction: column;
}

.call-video-container {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
}

#remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#local-video {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  background: #1a1a2e;
}

.call-info {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: white;
  z-index: 1;
}

.call-info-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.call-info-name {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 5px;
}

.call-type-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  font-size: 14px;
  margin-bottom: 10px;
}

.call-status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffa500;
}

.call-controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 1;
}

.call-control-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.call-control-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.3);
}

.call-control-btn.active {
  background: var(--accent-color);
}

.call-control-end {
  background: #e94560 !important;
}

.call-control-end:hover {
  background: #d63651 !important;
}
