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

:root {
  --msn-blue: #0078D7;
  --msn-blue-dark: #005A9E;
  --msn-blue-light: #4DA6FF;
  --online-green: #00C853;
  --away-orange: #FF9800;
  --busy-red: #F44336;
  --invisible-gray: #9E9E9E;
  --offline-dark: #424242;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f7fb;
  --bg-chat: #e8ecf1;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="escuro"] {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-chat: #0f3460;
  --text-primary: #e5e5e5;
  --text-secondary: #a0a0a0;
  --border-color: #2a2a4a;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="msn-classic"] {
  --bg-primary: #f0f0f0;
  --bg-secondary: #e8e8e8;
  --bg-chat: #d4e4f7;
  --text-primary: #003399;
  --text-secondary: #666;
  --border-color: #a0c4e8;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--msn-blue) 0%, var(--msn-blue-dark) 100%);
  padding: 20px;
}

.login-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--msn-blue);
  letter-spacing: -0.5px;
}

.login-logo .slogan {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

.form-floating {
  margin-bottom: 16px;
}

.form-floating > .form-control {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-floating > label {
  color: var(--text-secondary);
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--msn-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-login:hover {
  background: var(--msn-blue-dark);
  transform: translateY(-1px);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
}

.login-footer a {
  color: var(--msn-blue);
  text-decoration: none;
  font-weight: 500;
}

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

.chat-layout {
  display: flex;
  height: 100vh;
}

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

.sidebar-header {
  height: var(--header-height);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  box-sizing: border-box;
  border: 2px solid #a8d8ff;
  transition: border-color 0.2s;
}

.user-avatar:hover {
  border-color: #4a90d9;
}

.profile-pic {
  width: 120px;
  height: 120px;
  object-fit: cover;
  box-sizing: border-box;
  border: 3px solid #a8d8ff;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(74, 144, 217, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.4);
}

.profile-pic-sm {
  width: 100px;
  height: 100px;
  object-fit: cover;
  box-sizing: border-box;
  border: 3px solid #a8d8ff;
  border-radius: 20px;
  box-shadow: 0 0 12px rgba(74, 144, 217, 0.2), inset 0 0 6px rgba(255, 255, 255, 0.3);
}

.profile-pic-lg {
  width: 160px;
  height: 160px;
  object-fit: cover;
  box-sizing: border-box;
  border: 3px solid #a8d8ff;
  border-radius: 20px;
  box-shadow: 0 0 15px rgba(74, 144, 217, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.4);
}

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

.user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--online-green); }
.status-dot.ausente { background: var(--away-orange); }
.status-dot.ocupado { background: var(--busy-red); }
.status-dot.invisivel { background: var(--invisible-gray); }
.status-dot.offline { background: var(--offline-dark); }

.sidebar-search {
  position: relative;
  padding: 12px 16px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%236b7280" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 12px center;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--msn-blue);
  background: var(--bg-secondary) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%230078D7" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 12px center;
  outline: none;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
}

[data-theme="escuro"] .search-results-dropdown {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.search-results-dropdown.show {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

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

.search-result-item:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 2px solid #a8d8ff;
}

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

.search-result-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-username {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.search-result-empty {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

.search-result-action {
  flex-shrink: 0;
}

.search-result-action .btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  padding: 8px 12px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-secondary);
}

.nav-item.active {
  background: rgba(0, 120, 215, 0.1);
  color: var(--msn-blue);
}

.nav-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 2px solid #a8d8ff;
}

.nav-item-avatar.placeholder {
  background: linear-gradient(135deg, var(--msn-blue), var(--msn-blue-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

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

.nav-item-name {
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-preview {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.nav-item-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.unread-badge {
  background: var(--msn-blue);
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  min-width: 0;
}

.chat-header {
  height: var(--header-height);
  padding: 12px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.chat-header-name {
  font-weight: 600;
  font-size: 1rem;
}

.chat-header-status {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

.chat-actions-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-actions-btn:hover {
  background: var(--msn-blue);
  color: white;
  border-color: var(--msn-blue);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.chat-messages-spacer {
  flex-shrink: 0;
  height: 40px;
}

.message-bubble {
  max-width: 70%;
  width: 300px;
  padding: 10px 14px;
  border-radius: var(--radius);
  position: relative;
  word-wrap: break-word;
  animation: messageIn 0.3s ease;
}

.message-bubble.sent {
  animation: messageSent 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

@keyframes messageSent {
  0% { 
    opacity: 0; 
    transform: translateX(20px) scale(0.9); 
  }
  60% { 
    opacity: 1; 
    transform: translateX(-3px) scale(1.02); 
  }
  80% { 
    transform: translateX(2px) scale(0.98); 
  }
   100% { 
     opacity: 1; 
     transform: translateX(0) scale(1); 
   }
 }

 @keyframes messageReceived {
  0% { 
    opacity: 0; 
    transform: translateX(-20px) scale(0.9); 
  }
  60% { 
    opacity: 1; 
    transform: translateX(3px) scale(1.02); 
  }
  80% { 
    transform: translateX(-2px) scale(0.98); 
  }
  100% { 
    opacity: 1; 
    transform: translateX(0) scale(1); 
  }
}

.message-bubble.sent {
  align-self: flex-end;
  background: var(--msn-blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  align-self: flex-start;
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
  animation: messageReceived 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.message-bubble.sistema {
  align-self: center;
  background: rgba(0,0,0,0.05);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  padding: 6px 12px;
  border-radius: 20px;
}

.message-sender {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
  gap: 6px;
  position: relative;
  top: -4px;
}

.message-sender-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  margin-top: -30px;
  margin-bottom: -6px;
  margin-left: -20px;
  background: #fff;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.message-content audio {
  width: 100%;
  max-width: 250px;
  height: 36px;
  margin-top: 4px;
  border-radius: 18px;
}

.message-content audio::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.9);
}

.message-bubble.sent .message-content audio::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.9);
}

.message-bubble.received .message-content audio::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.9);
}

.verified-badge {
  display: inline-block;
  margin-left: 4px;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.verified-badge-small {
  display: inline-block;
  margin-left: 6px;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.nav-item.blocked-item {
  opacity: 0.6;
}

.nav-item.blocked-item .nav-item-name::after {
  content: " 🚫";
}

.delete-msg-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 0.9rem;
}

.delete-msg-btn:hover {
  opacity: 1;
  color: var(--cor-danger, #dc3545);
}

.message-bubble.deleted-bubble {
  opacity: 0.6;
}

.message-bubble .message-content.deleted {
  color: var(--text-secondary);
  font-style: italic;
}

.message-content {
  font-size: 0.9375rem;
  line-height: 1.4;
}

.message-time {
  font-size: 0.6875rem;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.message-read-receipt {
  font-size: 0.6875rem;
  opacity: 0.7;
  margin-left: 4px;
}

.chat-input-area {
  padding: 12px 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9375rem;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 4px 0;
  font-family: inherit;
}

.chat-input:focus {
  outline: none;
}

.link-preview-wrapper {
  margin-bottom: 8px;
}

.link-preview-card {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  margin: 4px 0;
  width: 30%;
}

.link-preview-card .link-preview-image {
  width: 100%;
  max-width: 100%;
  max-height: 150px;
  object-fit: cover;
  display: block;
}

.link-preview-content {
  padding: 8px 10px;
}

.link-preview-site {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.link-preview-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-link-preview {
  margin-top: 4px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.message-link-preview .link-preview-card {
  max-width: 100%;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.message-link-preview .message-video-embed {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 0;
  padding-bottom: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.message-link-preview .message-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-preview-card {
  display: flex;
  flex-direction: column;
}

.video-preview-card .link-preview-content {
  display: flex;
  flex-direction: column;
}

.message-bubble.sent .link-preview-card {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.message-bubble.sent .link-preview-site {
  color: rgba(255, 255, 255, 0.8);
}

.message-bubble.sent .link-preview-title {
  color: white;
}

.message-bubble.sent .link-preview-description {
  color: rgba(255, 255, 255, 0.7);
}

.chat-input-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-input-btn:hover {
  background: rgba(0, 120, 215, 0.1);
  color: var(--msn-blue);
}

.chat-input-btn.send {
  background: var(--msn-blue);
  color: white;
}

.chat-input-btn.send:hover {
  background: var(--msn-blue-dark);
}

.chat-input-btn.recording {
  background: #dc3545 !important;
  color: white !important;
  animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.nudge-animation {
  animation: nudgeShake 0.5s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes nudgeShake {
  0% { transform: translateX(0) rotate(0); }
  8% { transform: translateX(-10px) rotate(-2deg); }
  16% { transform: translateX(10px) rotate(2deg); }
  24% { transform: translateX(-8px) rotate(-1deg); }
  32% { transform: translateX(8px) rotate(1deg); }
  40% { transform: translateX(-5px) rotate(-0.5deg); }
  48% { transform: translateX(5px) rotate(0.5deg); }
  56% { transform: translateX(-3px) rotate(-0.2deg); }
  64% { transform: translateX(3px) rotate(0.2deg); }
  72% { transform: translateX(-1px) rotate(-0.1deg); }
  80% { transform: translateX(1px) rotate(0.1deg); }
  88%, 100% { transform: translateX(0) rotate(0); }
}

.wink-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.wink-animation {
  position: absolute;
  font-size: 3rem;
  animation: winkFloat 2s ease-out forwards;
}

@keyframes winkFloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-200px) scale(1.5); }
}

.emoji-picker {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  max-height: 360px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.emoji-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.9rem;
}

.emoji-picker-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
}

.emoji-picker-body {
  padding: 10px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.emoji-item {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.emoji-item:hover {
  background: var(--bg-secondary);
}

.gif-picker-body {
  padding: 10px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gif-item {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: var(--radius-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    /* overflow: hidden; */
    aspect-ratio: 1 / 1;
    position: relative;
    display: block;
}

.gif-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.gif-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .hamburger-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .hamburger-btn:hover {
    background: var(--msn-blue);
    color: white;
    border-color: var(--msn-blue);
  }

  .hamburger-btn.chat-open {
    display: none;
  }

  .sidebar-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
  }

  .sidebar-back-btn:hover {
    background: var(--msn-blue);
    color: white;
    border-color: var(--msn-blue);
  }

  .sidebar-header {
    padding: 10px 12px;
  }

  .sidebar-header .dropdown .chat-actions-btn {
    width: 32px;
    height: 32px;
  }

  .sidebar-nav {
    padding: 0 4px;
  }

  .nav-item {
    padding: 10px 10px;
    gap: 10px;
  }

  .nav-item-avatar {
    width: 36px;
    height: 36px;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-header {
    padding: 8px 12px;
  }

  .chat-header-actions .chat-actions-btn {
    width: 32px;
    height: 32px;
  }

  .chat-messages {
    padding: 12px 16px;
  }

  .message-bubble {
    max-width: 85%;
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .chat-input-area {
    padding: 10px 12px;
  }

  .chat-input-wrapper {
    padding: 6px 10px;
    gap: 4px;
  }

  .chat-input-btn {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .message-toast {
    width: 90vw;
    max-width: 320px;
    right: 8px;
    left: 8px;
  }

  .user-online-toast {
    max-width: 90vw;
    bottom: 12px;
    right: 12px;
  }

  .emoji-picker {
    width: 90vw;
    max-width: 100%;
    bottom: 0;
    left: 0;
    transform: none;
    max-height: 40vh;
    border-radius: 12px 12px 0 0;
  }

  .emoji-picker-body {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
  }

  .gif-picker-body {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .sticker-picker-body {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .wallpaper-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .avatar-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .profile-pic {
    width: 100px;
    height: 100px;
  }

   .profile-pic-sm {
    width: 80px;
    height: 80px;
  }

  .profile-pic-lg {
    width: 120px;
    height: 120px;
  }

  .call-overlay video {
    max-width: 95vw;
    max-height: 70vh;
  }

  .call-avatar {
    width: 100px;
    height: 100px;
  }

  .call-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .call-controls {
    gap: 12px;
  }

  .login-card {
    padding: 28px 20px;
    border-radius: var(--radius);
  }
}

@media (max-width: 576px) {
  .sidebar {
    width: 100%;
  }

  .sidebar-back-btn {
    width: 32px;
    height: 32px;
  }

  .hamburger-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .sidebar-header {
    padding: 8px 10px;
    gap: 8px;
  }

   .user-name {
    font-size: 0.85rem;
  }

  .sidebar-name-text {
    display: inline-block;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .verified-badge-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    vertical-align: middle;
  }

  .user-status {
    font-size: 0.7rem;
  }

  .nav-item {
    padding: 8px 8px;
    gap: 8px;
  }

  .nav-item-avatar {
    width: 32px;
    height: 32px;
  }

   .nav-item-name {
    font-size: 0.85rem;
  }

  .nav-item-name-text {
    display: inline-block;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .nav-item-preview {
    font-size: 0.75rem;
  }

  .nav-section-title {
    font-size: 0.625rem;
  }

  .chat-header {
    padding: 8px 10px;
    gap: 8px;
  }

   .chat-header-name {
    font-size: 0.95rem;
  }

  .chat-header-name-text {
    display: inline-block;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .chat-header-status {
    font-size: 0.75rem;
  }

  .chat-header-actions {
    gap: 2px;
  }

  .chat-header-actions .chat-actions-btn {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  .chat-messages {
    padding: 10px 12px;
  }

  .message-bubble {
    max-width: 90%;
    padding: 6px 10px;
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .message-time {
    font-size: 0.625rem;
    margin-top: 2px;
  }

  .message-content {
    font-size: 0.85rem;
  }

  .chat-input-area {
    padding: 8px 10px;
  }

  .chat-input-wrapper {
    padding: 6px 8px;
  }

  .chat-input {
    font-size: 0.85rem;
    max-height: 100px;
  }

  .chat-input-btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .chat-input-btn.send {
    font-size: 0.9rem;
  }

  .message-toast {
    width: 95vw;
    max-width: none;
    right: 4px;
    left: 4px;
    padding: 10px;
  }

  .user-online-toast {
    max-width: 95vw;
    bottom: 10px;
    right: 10px;
  }

  .emoji-picker-body {
    grid-template-columns: repeat(5, 1fr);
  }

  .gif-picker-body {
    grid-template-columns: repeat(2, 1fr);
  }

  .sticker-picker-body {
    grid-template-columns: repeat(2, 1fr);
  }

  .wallpaper-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .avatar-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .login-card {
    padding: 24px 16px;
  }

  .login-logo h1 {
    font-size: 1.7rem;
  }

  .login-footer {
    font-size: 0.8rem;
  }

  .link-preview-card {
    width: 100%;
    margin: 4px 0;
  }

  .link-preview-title {
    font-size: 0.75rem;
  }

  .link-preview-description {
    font-size: 0.7rem;
  }

  .link-preview-site {
    font-size: 0.625rem;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 100%;
  }

  .sidebar-header {
    padding: 6px 8px;
    gap: 6px;
  }

  .user-info {
    display: none;
  }

  .sidebar-header .dropdown {
    margin-left: auto;
  }

  .sidebar-search {
    padding: 8px 10px;
  }

  .nav-item {
    padding: 6px 6px;
    gap: 6px;
  }

  .nav-item-avatar {
    width: 28px;
    height: 28px;
  }

  .nav-item-info {
    flex: 1;
  }

  .nav-item-meta {
    flex-shrink: 0;
    min-width: 50px;
  }

  .nav-item-time {
    font-size: 0.625rem;
  }

  .unread-badge {
    font-size: 0.55rem;
    min-width: 14px;
    height: 14px;
    border-radius: 6px;
  }

  .chat-header {
    padding: 6px 8px;
  }

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

  .chat-header-name {
    font-size: 0.85rem;
  }

  .chat-header-status {
    font-size: 0.7rem;
  }

  .chat-header-actions .chat-actions-btn {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }

  .sidebar-back-btn {
    width: 28px;
    height: 28px;
  }

  .chat-messages {
    padding: 8px 10px;
  }

  .message-bubble {
    max-width: 95%;
    padding: 6px 10px;
    font-size: 0.78rem;
    border-radius: 10px;
  }

  .message-bubble.sent {
    border-bottom-right-radius: 4px;
  }

  .message-bubble.received {
    border-bottom-left-radius: 4px;
  }

  .message-sender {
    font-size: 0.65rem;
  }

  .message-time {
    font-size: 0.58rem;
  }

  .message-read-receipt {
    font-size: 0.58rem;
  }

  .message-content {
    font-size: 0.8rem;
  }

  .reply-context {
    font-size: 0.72rem;
  }

  .reply-btn {
    font-size: 0.68rem;
  }

  .chat-input-area {
    padding: 6px 8px;
  }

  .chat-input-wrapper {
    padding: 4px 6px;
    gap: 2px;
  }

  .chat-input {
    font-size: 0.8rem;
    max-height: 90px;
  }

  .chat-input-btn {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }

  .chat-input-btn.send {
    font-size: 0.8rem;
  }

  .chat-header-actions .chat-actions-btn {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .sidebar-back-btn {
    width: 26px;
    height: 26px;
  }

  .link-preview-card {
    width: 100%;
  }

  .link-preview-title {
    font-size: 0.7rem;
  }

  .link-preview-description {
    font-size: 0.65rem;
  }

  .link-preview-site {
    font-size: 0.58rem;
  }

  .profile-pic {
    width: 80px;
    height: 80px;
  }

   .profile-pic-sm {
    width: 64px;
    height: 64px;
  }

  .profile-pic-lg {
    width: 100px;
    height: 100px;
  }

  .call-overlay video {
    max-width: 98vw;
    max-height: 75vh;
  }

  .call-avatar {
    width: 80px;
    height: 80px;
  }

  .call-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .login-card {
    padding: 20px 12px;
  }

  .login-logo h1 {
    font-size: 1.5rem;
  }

  .form-floating {
    margin-bottom: 12px;
  }

  .btn-login {
    padding: 10px;
    font-size: 0.9rem;
  }

  .login-footer {
    font-size: 0.75rem;
  }
}

@media (max-width: 360px) {
  .sidebar-search {
    padding: 6px 8px;
  }

  .search-input {
    padding: 6px 10px 6px 30px;
    font-size: 0.8rem;
  }

    .nav-item-name {
      font-size: 0.78rem;
    }

    .nav-item-name-text {
      max-width: 9ch;
    }

  .nav-item-preview {
    font-size: 0.7rem;
  }

  .message-bubble {
    max-width: 98%;
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .message-sender {
    font-size: 0.62rem;
  }

  .message-time {
    font-size: 0.55rem;
  }

  .message-content {
    font-size: 0.75rem;
  }

  .chat-input-area {
    padding: 4px 6px;
  }

  .chat-input-wrapper {
    padding: 4px 6px;
  }

  .chat-input {
    font-size: 0.78rem;
    max-height: 80px;
  }

  .chat-input-btn {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }

  .link-preview-card {
    margin: 2px 0;
  }

  .link-preview-title {
    font-size: 0.65rem;
  }

  .link-preview-description {
    font-size: 0.6rem;
  }

  .link-preview-site {
    font-size: 0.52rem;
  }

  .login-logo h1 {
    font-size: 1.35rem;
  }

  .login-card {
    padding: 16px 10px;
  }

  .btn-login {
    padding: 9px;
    font-size: 0.85rem;
  }

  .login-footer {
    font-size: 0.7rem;
  }

  .emoji-picker {
    max-height: 35vh;
  }

  .emoji-picker-body {
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
  }
}

.call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.call-overlay video {
  max-width: 80%;
  max-height: 60%;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.call-avatar {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  object-fit: cover;
  margin-bottom: 20px;
  box-sizing: border-box;
  border: 3px solid #a8d8ff;
}

.call-controls {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.call-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
}

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

.call-btn.reject {
  background: var(--busy-red);
  color: white;
}

.typing-indicator {
  font-size: 0.75rem;
  color: var(--msn-blue);
  font-style: italic;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  background: var(--msn-blue);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--msn-blue);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
}

@keyframes notificationBounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
}

.notification-bounce {
  animation: notificationBounce 0.6s ease-in-out;
}

.reply-btn {
  background: none;
  border: none;
  color: var(--msn-blue);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.reply-btn:hover {
  opacity: 1;
  text-decoration: underline;
}

.reply-context {
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--msn-blue);
  padding-left: 8px;
  margin-bottom: 6px;
  font-style: italic;
  opacity: 0.9;
}

.message-bubble.emoji-only-message {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  font-size: 3rem !important;
  max-width: none !important;
}

.message-bubble.emoji-only-message .message-time {
  display: none;
}

.message-bubble.emoji-only-message .message-sender {
  display: none;
}

.message-bubble.emoji-only-message .reply-btn {
  display: none;
}

.message-bubble.emoji-only-message .reply-context {
  display: none;
}

.message-bubble.gif-only-message {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  max-width: 200px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.message-bubble.gif-only-message .message-sender {
  display: none;
}

.message-bubble.gif-only-message .message-time {
  display: none;
}

.message-bubble.gif-only-message .message-content {
  display: flex;
  justify-content: flex-end;
}

.message-bubble.sent.gif-only-message .message-content {
  justify-content: flex-end;
}

.message-bubble.received.gif-only-message .message-content {
  justify-content: flex-start;
}

.gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.sticker-picker-body {
  padding: 10px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sticker-item {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: var(--radius-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    position: relative;
    display: block;
}

.sticker-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.sticker-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    pointer-events: none;
}

.message-bubble.gif-only-message .message-content img {
  max-width: 200px;
  border-radius: 12px;
  margin-top: 0;
  box-shadow: var(--shadow);
}

.message-bubble.sticker-only-message {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  max-width: 120px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.message-bubble.sticker-only-message .message-sender {
  display: none;
}

.message-bubble.sticker-only-message .message-time {
  display: none;
}

.message-bubble.sticker-only-message .message-content {
  display: flex;
  justify-content: flex-end;
}

.message-bubble.sent.sticker-only-message .message-content {
  justify-content: flex-end;
}

.message-bubble.received.sticker-only-message .message-content {
  justify-content: flex-start;
}

.message-bubble.sticker-only-message .message-content img {
  max-width: 120px;
  border-radius: 16px;
  margin-top: 0;
  box-shadow: var(--shadow);
}

.message-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 8px;
  color: #dc2626;
  text-decoration: none;
  font-weight: 500;
  margin-top: 4px;
  display: inline-block;
}

.message-pdf-icon {
  font-size: 1.5rem;
}

.chat-area.custom-wallpaper {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.wallpaper-option {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  background: var(--bg-secondary);
}

.wallpaper-option:hover {
  border-color: var(--msn-blue);
  transform: scale(1.03);
}

.wallpaper-option.active {
  border-color: var(--msn-blue);
  box-shadow: 0 0 0 2px var(--msn-blue);
}

.wallpaper-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.avatar-gallery-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
  background: var(--bg-secondary);
  position: relative;
}

.avatar-gallery-item:hover {
  border-color: var(--msn-blue);
  transform: scale(1.05);
}

.avatar-gallery-item.selected {
  border-color: var(--msn-blue);
  box-shadow: 0 0 0 2px var(--msn-blue);
}

.avatar-gallery-item.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 6px;
  color: white;
  font-weight: bold;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.avatar-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 280px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.3s, transform 0.3s;
  border-left: 4px solid var(--msn-blue);
}

.message-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.message-toast-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 2px solid #a8d8ff;
}

.message-toast-content {
  min-width: 0;
  flex: 1;
}

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

.message-toast-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-online-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.user-online-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(120%);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto;
  cursor: default;
  max-width: 280px;
}

.user-online-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.user-online-toast.hide {
  opacity: 0;
  transform: translateX(120%);
}

.user-online-toast-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 2px solid #a8d8ff;
}

.user-online-toast-info {
  flex: 1;
  min-width: 0;
}

.user-online-toast-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-online-toast-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.user-online-toast-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--online-green);
  box-shadow: 0 0 0 2px rgba(0, 200, 83, 0.2);
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(0, 200, 83, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(0, 200, 83, 0.5); }
}

[data-theme="escuro"] .user-online-toast {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-dialog.modal-lg,
  .modal-dialog.modal-dialog-centered.modal-dialog-scrollable {
    width: 100%;
    max-width: 100%;
  }

  .modal-content {
    border-radius: var(--radius-sm);
  }

  .modal-header h5 {
    font-size: 1.1rem;
  }
}

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.marketplace-product-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.marketplace-product-seller {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.marketplace-seller-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.marketplace-seller-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.marketplace-seller-username {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.marketplace-product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.marketplace-product-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 3px solid var(--msn-blue);
    transition: transform 0.2s, border-color 0.2s;
}

.marketplace-product-card:hover .marketplace-product-img {
    transform: scale(1.08);
    border-bottom-color: var(--msn-blue-light);
}

.marketplace-product-info {
  padding: 10px;
}

.marketplace-product-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marketplace-product-price {
  font-size: 0.8rem;
  color: var(--msn-green);
  font-weight: 600;
  margin-bottom: 8px;
}

@media (max-width: 992px) {
  .marketplace-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .marketplace-product-card {
    max-width: 100%;
  }

  .marketplace-product-img {
    height: 180px;
  }
}

@media (max-width: 768px) {
  .marketplace-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .marketplace-grid {
    grid-template-columns: 1fr;
  }

  .marketplace-product-img {
    height: 140px;
  }
}

@media (max-width: 480px) {
  .marketplace-product-img {
    height: 130px;
  }
}

@media (max-width: 360px) {
  .marketplace-product-img {
    height: 100px;
  }
}

.marketplace-page-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.marketplace-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.marketplace-page-header .btn-success {
  margin-top: 8px;
}

@media (max-width: 576px) {
  .marketplace-page-header {
    padding: 12px 16px;
  }

  .marketplace-title {
    font-size: 1.1rem;
  }
}

.marketplace-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--msn-blue);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 120, 215, 0.3);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  overflow: hidden;
}

.marketplace-fab:hover {
  background: var(--msn-blue-dark);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 120, 215, 0.4);
}

.marketplace-fab:active {
  transform: scale(0.95);
}

.marketplace-fab-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 16px;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.cookie-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.cookie-text {
  flex: 1;
  min-width: 300px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.cookie-text a {
  color: #4da6ff;
  text-decoration: underline;
}

.cookie-buttons {
  display: flex;
  gap: 8px;
}

.btn-cookie {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cookie-accept {
  background: var(--msn-blue);
  color: white;
}

.btn-cookie-accept:hover {
  background: var(--msn-blue-dark);
}

.btn-cookie-reject {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-cookie-reject:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .cookie-content {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-buttons {
    justify-content: center;
  }
}

.marketplace-notice {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 6px;
  margin-bottom: 8px;
}

.marketplace-page {
  overflow: auto !important;
  height: auto !important;
}

.marketplace-page .chat-layout {
  min-height: 100vh;
  height: auto;
}
