/* ATHALAIA CHAT - MODERN GRADIENT DESIGN SYSTEM */

:root {
  --bg-primary: #070c18;
  --bg-secondary: #0d1527;
  --bg-chat: #050812;
  --bg-input: #142036;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-light: #60a5fa;
  --accent-orange: #FF6B00;
  --accent-gold: #FF8C00;
  --grad-brand: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #0284c7 100%);
  --grad-orange: linear-gradient(135deg, #FF4500 0%, #FF8C00 50%, #FFC700 100%);
  --grad-cyan: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  --grad-bubble-sent: linear-gradient(135deg, #0052D4 0%, #4364F7 50%, #00C6FF 100%);
  --msg-sent: #0052D4;
  --msg-received: #131e33;
  --border: rgba(0, 210, 255, 0.18);
  --danger: #ef4444;
  --success: #10b981;
  --shadow: 0 10px 30px -5px rgba(0, 210, 255, 0.2);
  --shadow-glow: 0 0 20px rgba(0, 210, 255, 0.35);
  --radius: 12px;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-chat: #f8fafc;
  --bg-input: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #6366f1;
  --msg-sent: #e0e7ff;
  --msg-received: #ffffff;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* App Container */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
}

/* Auth Screens */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 20%, #0d1e3d 0%, #050914 90%);
}

.auth-card {
  background: rgba(13, 21, 39, 0.85);
  backdrop-filter: blur(16px);
  padding: 2.5rem;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.25);
  text-align: center;
}

.auth-card h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.auth-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.2rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .form-control {
  padding-right: 2.75rem;
}

.toggle-password-btn {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition:
    color 0.2s,
    background-color 0.2s;
  z-index: 2;
}

.toggle-password-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.4rem;
  background: var(--grad-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.35);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 210, 255, 0.5);
  filter: brightness(1.1);
}

.auth-switch {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-switch a,
.auth-link {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.2s ease,
    text-decoration 0.2s ease;
}

.auth-switch a:hover,
.auth-link:hover,
.auth-switch a:focus,
.auth-link:focus {
  color: #818cf8;
  text-decoration: underline;
}

/* Sidebar */
.sidebar {
  width: 360px;
  min-width: 300px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Floating Action Button (FAB) - Adicionar Contato */
.fab-btn {
  position: absolute;
  bottom: 24px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.45), 0 0 15px rgba(255, 107, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 99;
}

.fab-btn:hover {
  transform: scale(1.12) rotate(90deg);
  box-shadow: 0 10px 32px rgba(0, 210, 255, 0.65), 0 0 20px rgba(255, 107, 0, 0.6);
}

.fab-btn:active {
  transform: scale(0.92);
}

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

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  position: relative;
  object-fit: cover;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

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

.user-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.user-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sidebar-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

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

/* Search Box */
.search-container {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-input {
  width: 100%;
  padding: 0.6rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

/* Conversations List */
.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}

.conversation-item:hover,
.conversation-item.active {
  background-color: var(--bg-input);
}

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

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

.conv-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.badge-unread {
  background-color: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-chat);
}

.chat-header {
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.message-row.sent {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.message-row.received {
  flex-direction: row;
  justify-content: flex-start;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin-bottom: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message-bubble {
  max-width: 72%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message-bubble.sent {
  background-color: var(--msg-sent);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

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

.message-sender {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 0.25rem;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.35rem;
}

.message-bubble.received .message-meta {
  color: var(--text-muted);
}

.message-reactions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.reaction-badge {
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Image Thumbnail Styling in Messages */
.message-image-thumb {
  max-width: 250px;
  max-height: 250px;
  width: auto;
  height: auto;
  border-radius: 10px;
  margin-top: 0.35rem;
  cursor: pointer;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.message-image-thumb:hover {
  transform: scale(1.02);
  opacity: 0.95;
}

/* Fullscreen Image Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lightbox-content {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  object-fit: contain;
  border: 1px solid var(--border);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 25px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.6);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(239, 68, 68, 0.8);
}

/* Custom Voice Note / Audio Player with Avatar & Mic Badge */
.custom-audio-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  margin-top: 0.35rem;
  min-width: 250px;
}

.audio-avatar-container {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.audio-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  overflow: hidden;
}

.audio-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.audio-mic-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

.audio-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.play-pause-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.play-pause-btn:hover {
  transform: scale(1.08);
}

.audio-scrubber-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}

.audio-scrubber-progress {
  height: 100%;
  background: var(--accent-light);
  border-radius: 2px;
  width: 0%;
}

.audio-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
}

.audio-speed-tag {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.audio-recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background-color: var(--bg-input);
  padding: 0.6rem 1rem;
  border-radius: 24px;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--danger);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1s infinite;
  margin-right: 0.5rem;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== Recursos de mensageria: badge, meta e menu contextual ===== */
.conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.conv-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.badge-unread {
  background-color: var(--success, #22c55e);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.conv-mute-icon {
  font-size: 0.72rem;
  opacity: 0.75;
}
.msg-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 220px;
  background: var(--bg-secondary, #1e2235);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: ctxIn 0.12s ease-out;
}
@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.ctx-reactions {
  display: flex;
  gap: 2px;
  justify-content: space-between;
  padding: 0.25rem 0.15rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.25rem;
}
.ctx-reactions button {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  transition: transform 0.12s ease, background 0.12s ease;
}
.ctx-reactions button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.2);
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-primary, #e5e7eb);
  font-size: 0.86rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ctx-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.ctx-item.ctx-danger {
  color: #f87171;
}
.ctx-icon {
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

/* ===== Barra de filtros de conversas ===== */
.conv-filter-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.conv-filter-bar::-webkit-scrollbar {
  display: none;
}
.conv-filter-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: var(--text-muted, #94a3b8);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.conv-filter-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.conv-filter-btn.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #ffffff;
  font-weight: 700;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.4);
}
.filter-count {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.68rem;
  text-align: center;
  line-height: 16px;
}

/* ===== Tags, chamadas, banner fixada, modais ===== */
/* ===== Tags, chamadas, banner fixada, modais ===== */
.msg-forwarded-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  opacity: 0.75;
  margin-bottom: 0.25rem;
  font-style: italic;
}
.msg-fav-tag,
.msg-pin-tag {
  font-size: 0.72rem;
  margin-left: 2px;
}
.reaction-badge {
  cursor: pointer;
  user-select: none;
}
.reaction-badge b {
  font-size: 0.66rem;
  margin-left: 2px;
  color: var(--accent-light, #a5b4fc);
}
.reaction-badge.reaction-mine {
  border: 1px solid var(--accent-light, #a5b4fc);
}
.message-reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}
.message-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--accent-light, #a5b4fc);
  text-decoration: none;
  margin-top: 0.35rem;
  opacity: 0.9;
}
.message-download-btn:hover {
  opacity: 1;
  text-decoration: underline;
}
.message-reply-quote:hover {
  filter: brightness(1.15);
}
.message-highlight {
  animation: msgHighlight 2s ease;
}
@keyframes msgHighlight {
  0%, 60% { box-shadow: 0 0 0 2px var(--accent, #6366f1); }
  100% { box-shadow: none; }
}
.pinned-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  margin: 0.35rem 0.75rem;
  cursor: default;
  font-size: 0.78rem;
}
.pinned-banner-icon { font-size: 0.85rem; }
.pinned-banner-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: var(--text-primary, #e5e7eb);
}
.call-event-row {
  display: flex;
  justify-content: center;
  margin: 0.35rem 0;
}
.call-event-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input, #262a40);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  max-width: 320px;
}
.call-event-bubble.missed .call-event-icon,
.call-event-bubble.missed small {
  color: #f87171;
}
.call-event-icon { font-size: 1.1rem; }
.call-event-text { line-height: 1.25; }
.call-event-text small { opacity: 0.7; }
.call-event-time {
  font-size: 0.68rem;
  opacity: 0.6;
  margin-left: 0.4rem;
}
.ath-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ctxIn 0.15s ease-out;
}
.ath-modal {
  background: var(--bg-secondary, #1e2235);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: min(430px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 3rem));
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.ath-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  font-size: 0.95rem;
}
.ath-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.ath-modal-close:hover { color: var(--text-primary); }
.ath-modal-body {
  padding: 0.75rem;
  overflow-y: auto;
}
.ath-search-input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-input, #262a40);
  color: var(--text-primary);
  font-size: 0.88rem;
  margin-bottom: 0.6rem;
  box-sizing: border-box;
}
.ath-forward-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ath-forward-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  width: 100%;
}
.ath-forward-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.ath-forward-item .avatar {
  width: 38px;
  height: 38px;
  font-size: 1rem;
  flex-shrink: 0;
}
.ath-forward-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.ath-forward-info strong { font-size: 0.88rem; }
.ath-forward-info small { color: var(--text-muted); font-size: 0.74rem; }
.ath-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.2rem 0.5rem;
  font-size: 0.85rem;
}
.ath-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
  font-size: 0.85rem;
}
.ath-detail-row:last-child { border-bottom: none; }
.ath-detail-key {
  color: var(--text-muted);
  flex-shrink: 0;
}
.ath-detail-val {
  text-align: right;
  word-break: break-word;
}
@media (max-width: 640px) {
  .msg-context-menu { min-width: 200px; }
  .ath-modal { width: calc(100vw - 1.2rem); }
}

/* ===== Dialogo de confirmacao premium ===== */
.ath-confirm-overlay {
  background: rgba(0, 0, 0, 0.68);
  z-index: 10050;
}
.ath-modal-overlay.closing {
  animation: athOut 0.15s ease forwards;
}
@keyframes athOut {
  to { opacity: 0; }
}
.ath-confirm {
  width: min(380px, calc(100vw - 2rem));
  border-radius: 18px;
  text-align: center;
  animation: ctxIn 0.16s ease-out;
}
.ath-confirm-body {
  padding: 1.5rem 1.4rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}
.ath-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  box-shadow: 0 8px 22px -8px rgba(99, 102, 241, 0.55);
}
.ath-confirm-icon.danger {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.28));
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
  box-shadow: 0 8px 22px -8px rgba(239, 68, 68, 0.55);
}
.ath-confirm-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary, #e5e7eb);
}
.ath-confirm-message {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #9ca3af);
  line-height: 1.5;
}
.ath-confirm-actions {
  display: flex;
  gap: 0.6rem;
  padding: 0.9rem 1.4rem 1.35rem;
}
.ath-btn {
  flex: 1;
  padding: 0.62rem 1rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
.ath-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.ath-btn:active {
  transform: translateY(0);
}
.ath-btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #e5e7eb);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.ath-btn.primary {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.6);
}
.ath-btn.primary.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 6px 18px -6px rgba(239, 68, 68, 0.6);
}

/* Chat Input Bar */
.chat-input-container {
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
}

.reply-preview-bar {
  padding: 0.5rem 1rem;
  background-color: var(--bg-input);
  border-left: 3px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-card {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  border: 1px solid var(--border);
}

/* WebRTC Call UI Styling */
.call-card {
  background-color: var(--bg-secondary);
  border-radius: 20px;
  width: 90vw;
  max-width: 600px;
  height: 75vh;
  max-height: 520px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.call-pulse-avatar {
  width: 90px;
  height: 90px;
  font-size: 2.5rem;
  margin: auto;
  animation: callPulse 1.5s infinite;
}

@keyframes callPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
  }
  70% {
    box-shadow: 0 0 0 25px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

.call-btn-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.call-btn-circle:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.btn-danger {
  background-color: var(--danger);
}

.btn-success {
  background-color: var(--success);
}

.video-grid {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #000;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.local-video-el {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.call-controls-bar {
  position: absolute;
  bottom: 25px;
  display: flex;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  border: 1px solid var(--border);
  z-index: 20;
}

.call-control-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 20px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease;
}

.call-control-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.call-control-btn.btn-danger {
  background: var(--danger);
}

/* Left Navigation Rail (WhatsApp Web Style) */
.nav-rail {
  width: 64px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 0.75rem 0;
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-rail::-webkit-scrollbar {
  width: 0px;
  display: none;
  background: transparent;
}
.nav-rail::-webkit-scrollbar-thumb {
  background: transparent;
}

.nav-rail-top,
.nav-rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.nav-rail-bottom {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  width: 100%;
  padding-bottom: 0.5rem;
}

.nav-rail-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.35rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.2s,
    color 0.2s,
    transform 0.15s ease;
}

.nav-rail-btn:hover {
  background-color: var(--bg-input);
  color: var(--text-primary);
  transform: scale(1.05);
}

.nav-rail-btn.active {
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.45);
}

.nav-rail-btn.logout-btn:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Status Item & Ring */
.status-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.avatar-status-container {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.avatar-status-ring {
  border: 2px solid var(--accent);
  padding: 2px;
  border-radius: 50%;
}

.avatar-status-ring.viewed {
  border-color: var(--text-muted);
}

.status-add-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
  font-weight: 700;
}

/* Color Picker Dots */
.color-picker-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.color-picker-dot:hover {
  transform: scale(1.15);
}

.color-picker-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transform: scale(1.15);
}

/* Fullscreen Story Viewer */
.story-viewer-card {
  width: 90vw;
  max-width: 420px;
  height: 85vh;
  max-height: 720px;
  background: #000;
  border-radius: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border);
}

.story-progress-container {
  display: flex;
  gap: 4px;
  padding: 12px 12px 6px 12px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 30;
}

.story-progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  background: #ffffff;
  width: 0%;
  transition: width 0.1s linear;
}

.story-author-header {
  position: absolute;
  top: 18px;
  left: 0;
  width: 100%;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 30;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

.story-body {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 4rem 1.5rem 2rem 1.5rem;
  word-break: break-word;
}

.story-text-content {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  max-width: 100%;
}

.story-image-content {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.story-image-caption {
  position: absolute;
  bottom: 25px;
  left: 5%;
  width: 90%;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  backdrop-filter: blur(6px);
}

.story-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 30;
  transition: background 0.2s;
}

.story-nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.story-nav-btn.prev {
  left: 10px;
}

.story-nav-btn.next {
  right: 10px;
}

/* Online Meeting Room (Athalaia Meet) Styling */
.meeting-room-card {
  background-color: #0f172a;
  border-radius: 20px;
  width: 96vw;
  max-width: 1240px;
  height: 92vh;
  max-height: 860px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.meeting-header-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.meeting-grid-container {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0.75rem 0;
  overflow: hidden;
}

.meet-share-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent);
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85);
  z-index: 30;
  max-width: 500px;
  width: 90%;
  animation: fadeIn 0.2s ease-out;
}

.meet-video-grid {
  width: 100%;
  height: 100%;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.meet-video-grid.screen-sharing-active #meet-screen-video {
  display: block !important;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 1;
}

.meet-video-grid.screen-sharing-active #meet-local-video {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  z-index: 10;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.85);
  object-fit: cover;
}

.meet-video-el {
  flex: 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  background: #000;
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Responsive shell: list, conversation and existing detail overlays. */
#back-to-list-btn, .mobile-header, .mobile-bottom-nav { display: none; }
body, #app-container, .auth-wrapper { height: 100vh; height: 100dvh; }
#app-container { width: 100%; overflow: hidden; }
.auth-wrapper { overflow-y: auto; padding: 1rem; }
.auth-card { margin: auto; flex-shrink: 0; }
.sidebar, .chat-main, .chat-messages, .conversations-list,
.sidebar > [id^="tab-view-"], .ath-modal-body { min-height: 0; }
.sidebar, .chat-main, .chat-user-info, .chat-user-info > div,
.chat-input, .audio-body, .form-group { min-width: 0; }
.nav-rail, .sidebar, .avatar { flex-shrink: 0; }
.chat-header, .chat-input-container, .reply-preview-bar, .pinned-banner,
.sidebar-header, .search-container, .conv-filter-bar { flex-shrink: 0; }
.chat-header { flex-wrap: wrap; gap: 0.5rem; }
.chat-user-info { flex: 1; }
#chat-title, #chat-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat-header-actions { flex-wrap: wrap; }
.conv-preview, .conv-indicators { display: flex; gap: 0.35rem; align-items: center; }
.conv-last-msg { flex: 1; min-width: 0; }
.conv-indicators { flex-shrink: 0; }
.message-bubble { min-width: 0; overflow-wrap: anywhere; }
.message-bubble img, .message-bubble video, .message-bubble audio { max-width: 100%; }
.custom-audio-card { min-width: 0; width: 250px; max-width: 100%; }
.modal-backdrop, .lightbox-modal { height: 100vh; height: 100dvh; }
.modal-card { max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.ath-modal { max-height: calc(100dvh - 2rem); }
.conv-filter-bar { display: flex; gap: 0.35rem; padding: 0.5rem; overflow-x: auto; }
.conv-filter-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: 20px;
  padding: 0.5rem 0.65rem; background: var(--bg-secondary); color: var(--text-secondary); cursor: pointer; }
.conv-filter-btn.active { background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%); color: #fff; border-color: rgba(56, 189, 248, 0.5); box-shadow: 0 4px 12px rgba(29, 78, 216, 0.4); }
.filter-count { padding: 0 0.25rem; }
button:focus-visible, [role="button"]:focus-visible, input:focus-visible,
a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.mobile-more-action { display: block; width: 100%; min-height: 44px; padding: 0.75rem;
  border: 0; border-bottom: 1px solid var(--border); background: transparent;
  color: var(--text-primary); text-align: left; cursor: pointer; }
[data-theme="light"] .message-bubble.sent { color: var(--text-primary); }
[data-theme="light"] .message-bubble.sent .message-meta { color: var(--text-secondary); }

@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { width: 300px; }
  .nav-rail { width: 56px; }
  .chat-header, .chat-input-container, .chat-messages { padding: 0.65rem; }
  .message-bubble { max-width: calc(100% - 44px); padding: 0.65rem; }
  .chat-input-container { gap: 0.25rem; }
  #send-btn { padding: 0.6rem !important; }
}

@media (max-width: 767px) {
  #app-container { flex-direction: column; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .nav-rail, .sidebar-header { display: none; }
  .sidebar { width: 100%; min-width: 0; flex: 1; height: auto; border: 0; }
  .chat-main { display: none; width: 100%; height: auto; }
  .mobile-header { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between;
    min-height: 56px; padding: env(safe-area-inset-top) max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
    background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
  .mobile-logo { font-weight: 700; color: var(--accent-light); }
  .mobile-header-actions { display: flex; }
  .app-ready:not(.mobile-active) .mobile-bottom-nav { display: flex; }
  .mobile-bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--bg-secondary); border-top: 1px solid var(--border); }
  .mobile-nav-item { position: relative; flex: 1; min-width: 0; border: 0; background: transparent;
    color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px;
    align-items: center; justify-content: center; cursor: pointer; }
  .mobile-nav-item.active { color: var(--accent-light); background: var(--bg-input); }
  .mobile-nav-icon { font-size: 1.3rem; }
  .mobile-nav-label { font-size: 0.7rem; }
  .mobile-nav-badge { position: absolute; top: 2px; left: 55%; padding: 2px 5px;
    background: var(--accent); color: #fff; border-radius: 12px; font-size: 0.7rem; }
  .mobile-active #app-container { padding-bottom: 0; }
  .mobile-active .sidebar, .mobile-active .mobile-header { display: none; }
  .mobile-active .chat-main { display: flex; }
  #back-to-list-btn { display: inline-flex; margin-right: 0 !important; }
  .icon-btn, .play-pause-btn, .ath-modal-close, .conv-filter-btn { min-width: 44px; min-height: 44px; }
  .chat-header { padding: calc(0.35rem + env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) 0.35rem max(0.5rem, env(safe-area-inset-left)); }
  .chat-user-info { flex-basis: 100%; gap: 0.5rem; }
  #chat-header-actions { width: 100%; justify-content: flex-end; gap: 0.25rem !important; }
  .chat-messages { padding: 0.65rem max(0.5rem, env(safe-area-inset-right)) 0.65rem max(0.5rem, env(safe-area-inset-left)); }
  .message-bubble { max-width: calc(100% - 44px); padding: 0.65rem; }
  .chat-input-container { gap: 0.25rem; padding: 0.5rem max(0.4rem, env(safe-area-inset-right)) calc(0.5rem + env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-left)); }
  .chat-input { padding: 0.65rem; }
  #send-btn { min-height: 44px; padding: 0.6rem !important; }
  input, select, textarea, .search-input, .form-control, .chat-input { font-size: 16px !important; }
  .auth-card { padding: 1.25rem; }
  .auth-card .form-group { flex-basis: 100% !important; }
  .auth-card div[style*="display: flex"] { flex-wrap: wrap; }
  .modal-card { width: calc(100% - 1rem); padding: 1rem; }
  .meeting-room-card, .call-card { width: 100%; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; padding: 1rem; }
  .audio-recording-bar { flex-wrap: wrap; gap: 0.25rem; padding: 0.5rem; }
  .audio-speed-tag { min-height: 44px; min-width: 44px; }
  .audio-scrubber-bar::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 44px; }
  body .toast-container { left: 0.5rem; right: 0.5rem; top: calc(0.5rem + env(safe-area-inset-top)); }
  body .toast-message { max-width: 100%; }
  .msg-context-menu { max-height: calc(100dvh - 1rem); overflow-y: auto; max-width: calc(100vw - 1rem); }
}

/* Premium Toast Notification System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff;
  border-radius: 12px;
  padding: 0.9rem 1.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 400px;
  line-height: 1.35;
}

.toast-message.success {
  border-left: 4px solid var(--success, #10b981);
}

.toast-message.error {
  border-left: 4px solid var(--danger, #ef4444);
}

.toast-message.info {
  border-left: 4px solid var(--accent-light, #818cf8);
}

.toast-message.toast-out {
  animation: toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-24px) scale(0.92);
  }
}

/* Mobile Header Logo & Menu Action Styles */
#mobile-header-logo-img {
  height: 38px;
  max-width: 200px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 210, 255, 0.25));
}

.mobile-more-action {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text-primary, #ffffff);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-more-action:hover, .mobile-more-action:active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15) 0%, rgba(255, 107, 0, 0.15) 100%);
  border-color: rgba(0, 210, 255, 0.4);
  transform: translateX(4px);
}

/* Custom 100% Transparent Scrollbars */
* {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

::-webkit-scrollbar {
  width: 0px !important;
  height: 0px !important;
  display: none !important;
  background: transparent !important;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb,
::-webkit-scrollbar-corner {
  background: transparent !important;
  border: none !important;
}

.modal-card, .ath-modal, .ath-modal-body, .nav-rail, .sidebar, .chat-main {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* ==========================================================================
   ATHALINK MODERN INSTAGRAM-STYLE STATUS & FEED LAYOUT
   ========================================================================== */

.status-feed-container {
  padding: 1.5rem 1rem;
  width: 100%;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.status-feed-wrapper {
  display: flex;
  gap: 2rem;
  max-width: 950px;
  width: 100%;
  margin: 0 auto;
  align-items: flex-start;
}

.status-feed-center-col {
  flex: 1;
  max-width: 630px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Stories Bar Carousel Card */
.status-stories-bar-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  padding: 1rem 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.status-stories-bar {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 0.25rem 0.25rem;
  align-items: center;
}

.status-story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  width: 72px;
  flex-shrink: 0;
  text-align: center;
  transition: transform 0.2s ease;
}

.status-story-item:hover {
  transform: scale(1.04);
}

.status-story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
  position: relative;
  box-sizing: border-box;
}

.status-story-ring.viewed {
  background: var(--border, #334155);
}

.status-story-ring.my-story-ring {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
}

.status-story-avatar-box {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-main, #0b1120);
  padding: 2px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 1.2rem;
}

.status-story-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.status-story-badge-add {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary, #1e293b);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.status-story-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary, #e2e8f0);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Create Status Card */
.status-create-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  padding: 0.85rem 1.1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.status-create-input-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.status-create-placeholder {
  flex: 1;
  background: var(--bg-input, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 24px;
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  color: var(--text-muted, #94a3b8);
  transition: all 0.2s ease;
}

.status-create-placeholder:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #ffffff);
}

.btn-create-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4);
}

.btn-create-status-icon:hover {
  transform: scale(1.08);
}

/* Feed Posts Stream */
.status-feed-posts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.status-post-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

/* Post Header */
.status-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-post-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-post-avatar-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
}

.status-post-avatar-box {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-main, #0b1120);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.status-post-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-post-user-names {
  display: flex;
  flex-direction: column;
}

.status-post-user-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary, #ffffff);
  line-height: 1.2;
}

.status-post-user-sub {
  font-size: 0.76rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 1px;
}

.status-post-more-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
}

/* Post Content Body */
.status-post-body {
  width: 100%;
  position: relative;
  background: #090d16;
  min-height: 240px;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.status-post-media {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
}

.status-post-text-card {
  width: 100%;
  min-height: 280px;
  padding: 2.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.status-post-text-content {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  max-width: 90%;
  word-break: break-word;
}

/* Post Action Bar */
.status-post-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem 0.4rem 1.1rem;
}

.status-post-actions-left {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.status-post-action-btn {
  background: transparent;
  border: none;
  color: var(--text-primary, #ffffff);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.status-post-action-btn:hover {
  transform: scale(1.12);
}

.status-post-action-btn.liked {
  color: #ef4444;
}

.status-post-likes-info {
  padding: 0.2rem 1.1rem 0.4rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.status-post-caption-box {
  padding: 0 1.1rem 0.6rem 1.1rem;
  font-size: 0.88rem;
  color: var(--text-primary, #e2e8f0);
  line-height: 1.4;
  word-break: break-word;
}

.status-post-caption-author {
  font-weight: 700;
  margin-right: 0.4rem;
}

.status-post-time-ago {
  padding: 0 1.1rem 0.6rem 1.1rem;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Post Quick Comment Input */
.status-post-comment-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.65rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-post-comment-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary, #ffffff);
  font-size: 0.86rem;
  outline: none;
}

.status-post-comment-input::placeholder {
  color: var(--text-muted, #94a3b8);
}

.btn-status-post-send {
  background: transparent;
  border: none;
  color: var(--accent-light, #60a5fa);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.btn-status-post-send:hover {
  opacity: 1;
}

/* Right Sidebar (Desktop) */
.status-feed-right-col {
  width: 310px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 1.5rem;
}

.status-active-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.25rem;
}

.status-active-user-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.status-suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.status-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.status-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-suggestion-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-follow-suggestion {
  background: transparent;
  border: none;
  color: var(--accent-light, #60a5fa);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-follow-suggestion:hover {
  color: #93c5fd;
}

.status-footer-credits {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  line-height: 1.6;
  margin-top: 1rem;
}

.status-footer-links span {
  cursor: pointer;
}

.status-footer-links span:hover {
  text-decoration: underline;
}

.status-copyright {
  margin-top: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.68rem;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
  .status-feed-container {
    padding: 0.75rem 0.5rem;
  }
  .status-feed-right-col {
    display: none;
  }
  .status-feed-center-col {
    max-width: 100%;
  }
  .status-post-card {
    border-radius: 12px;
  }
}


