/* ============================================================
   WEBBURNS CHAT — CHAT STYLES
   Messages, input, reactions, typing, status
   ============================================================ */

/* ── Chat Container ────────────────────────────────────────── */
.chat-messages {
  flex: 1; padding: 16px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--color-base-900);
  position: relative;
}

.chat-messages::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 30% 20%, rgba(102,126,234,0.04) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(118,75,162,0.03) 0%, transparent 50%);
  z-index: 0;
}

/* ── Message Groups ────────────────────────────────────────── */
.msg-group {
  display: flex; gap: 16px; padding: 4px 16px;
  border-radius: var(--radius-sm);
  position: relative; z-index: 1;
  transition: background var(--dur-fast) var(--ease-out);
  animation: msgSlideIn var(--dur-slow) var(--ease-out);
}

.msg-group:hover {
  background: rgba(255,255,255,0.02);
}

.msg-group.start {
  padding-top: 12px; margin-top: 8px;
}

.msg-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--text-sm); color: #fff;
  flex-shrink: 0; cursor: pointer;
  transition: opacity var(--dur-fast);
}

.msg-group:not(.start) .msg-avatar {
  visibility: hidden;
}

.msg-group:not(.start) .msg-header { display: none; }

.msg-body { flex: 1; min-width: 0; }

.msg-header {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px;
}

.msg-author {
  font-size: var(--text-base); font-weight: 600; color: var(--accent-indigo);
  cursor: pointer;
}
.msg-author:hover { text-decoration: underline; }

.msg-timestamp {
  font-size: var(--text-xs); color: var(--color-base-400);
}

.msg-group:not(.start) .msg-body::before {
  content: attr(data-time);
  font-size: var(--text-xs); color: var(--color-base-400);
  opacity: 0; position: absolute; left: 16px;
  transition: opacity var(--dur-fast);
}
.msg-group:not(.start):hover .msg-body::before { opacity: 1; }

/* ── Message Content ───────────────────────────────────────── */
.msg-text {
  font-size: var(--text-base); line-height: 1.5;
  color: var(--color-base-50); word-break: break-word;
}

.msg-text code {
  background: var(--color-base-700); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.msg-text pre {
  background: var(--color-base-700); padding: 12px 16px;
  border-radius: var(--radius-md); margin: 8px 0;
  overflow-x: auto; border: 1px solid var(--glass-border);
}

.msg-text pre code {
  background: none; padding: 0;
  font-size: var(--text-sm); line-height: 1.6;
}

.msg-text a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-decoration-color: rgba(79,172,254,0.3);
}
.msg-text a:hover { text-decoration-color: var(--accent-blue); }

.msg-text strong { font-weight: 700; }
.msg-text em { font-style: italic; }

/* ── Message Media ─────────────────────────────────────────── */
.msg-media {
  margin-top: 8px; border-radius: var(--radius-md);
  overflow: hidden; max-width: 400px;
  border: 1px solid var(--glass-border);
}

.msg-media img {
  width: 100%; cursor: pointer;
  transition: transform var(--dur-normal) var(--ease-out);
}
.msg-media img:hover { transform: scale(1.02); }

.msg-file {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--color-base-700);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); margin-top: 8px;
  max-width: 400px; cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.msg-file:hover { background: var(--color-base-600); border-color: var(--glass-border-hover); }

.msg-file-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: rgba(102,126,234,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-indigo); font-size: var(--text-lg);
}

.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-size: var(--text-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-size { font-size: var(--text-xs); color: var(--color-base-400); }

/* ── Message Status ────────────────────────────────────────── */
.msg-status {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; color: var(--color-base-400); margin-left: 6px;
}
.msg-status.sent { color: var(--color-base-400); }
.msg-status.delivered { color: var(--color-base-200); }
.msg-status.seen { color: var(--accent-blue); }

.msg-edited {
  font-size: var(--text-xs); color: var(--color-base-400);
  margin-left: 4px; font-style: italic;
}

/* ── Message Actions (hover toolbar) ───────────────────────── */
.msg-actions {
  position: absolute; top: -16px; right: 16px;
  display: flex; gap: 2px;
  background: var(--color-base-700);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 2px; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-md);
}

.msg-group:hover .msg-actions { opacity: 1; pointer-events: all; }

.msg-action-btn {
  width: 32px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-base-200); font-size: var(--text-sm);
  transition: all var(--dur-fast);
}
.msg-action-btn:hover { background: var(--color-base-500); color: #fff; }

/* ── Reactions ─────────────────────────────────────────────── */
.msg-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}

.reaction-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--color-base-700);
  border: 1px solid var(--glass-border);
  font-size: var(--text-sm); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.reaction-pill:hover { border-color: var(--glass-border-hover); background: var(--color-base-600); }
.reaction-pill.mine { border-color: rgba(102,126,234,0.4); background: rgba(102,126,234,0.1); }
.reaction-count { font-size: var(--text-xs); color: var(--color-base-200); }

.add-reaction-btn {
  width: 28px; height: 26px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--color-base-700); border: 1px solid var(--glass-border);
  color: var(--color-base-400); font-size: var(--text-sm);
  cursor: pointer; opacity: 0;
  transition: all var(--dur-fast);
}
.msg-group:hover .add-reaction-btn { opacity: 1; }
.add-reaction-btn:hover { background: var(--color-base-600); color: #fff; }

/* ── Reply Thread ──────────────────────────────────────────── */
.msg-reply-context {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; margin-bottom: 4px;
  border-left: 2px solid var(--accent-indigo);
  font-size: var(--text-xs); color: var(--color-base-200);
  cursor: pointer; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.msg-reply-context:hover { background: rgba(102,126,234,0.05); }
.msg-reply-author { font-weight: 600; color: var(--accent-indigo); }

/* ── Typing Indicator ──────────────────────────────────────── */
.typing-bar {
  padding: 4px 16px; font-size: var(--text-xs);
  color: var(--color-base-200); min-height: 24px;
  display: flex; align-items: center; gap: 8px;
}

.typing-dots {
  display: flex; gap: 3px;
}
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-indigo);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Chat Input Area ───────────────────────────────────────── */
.chat-input-area {
  padding: 0 16px 16px; flex-shrink: 0;
  position: relative;
}

.chat-input-wrapper {
  background: var(--color-base-700);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-normal) var(--ease-out);
  overflow: hidden;
}

.chat-input-wrapper:focus-within {
  border-color: var(--glass-border-active);
}

/* Reply Preview */
.reply-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: rgba(102,126,234,0.05);
  border-bottom: 1px solid var(--glass-border);
}
.reply-preview-text { flex: 1; font-size: var(--text-xs); color: var(--color-base-200); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview-close { color: var(--color-base-400); cursor: pointer; }

/* Upload Preview */
.upload-preview {
  display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto;
  border-bottom: 1px solid var(--glass-border);
}
.upload-preview-item {
  position: relative; width: 80px; height: 80px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; border: 1px solid var(--glass-border);
}
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer;
}

/* Input Row */
.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 12px;
}

.chat-input-actions {
  display: flex; gap: 2px; flex-shrink: 0;
}

.chat-input-action {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-base-200); font-size: var(--text-base);
  transition: all var(--dur-fast);
}
.chat-input-action:hover { background: var(--color-base-600); color: #fff; }

.chat-input-field {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--color-base-white); font-size: var(--text-base);
  padding: 8px 0; resize: none; max-height: 200px;
  min-height: 20px; line-height: 1.4;
  font-family: var(--font-sans);
}
.chat-input-field::placeholder { color: var(--color-base-400); }

.chat-send-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--gradient-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-normal) var(--ease-out);
  flex-shrink: 0; opacity: 0.5;
}
.chat-send-btn.active { opacity: 1; }
.chat-send-btn.active:hover { transform: scale(1.05); box-shadow: var(--shadow-glow); }

/* ── Date Separator ────────────────────────────────────────── */
.date-separator {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; margin: 8px 0;
  z-index: 1;
}
.date-separator span {
  font-size: var(--text-xs); font-weight: 700; color: var(--color-base-400);
  white-space: nowrap; padding: 4px 12px;
  background: var(--color-base-700); border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
}
.date-separator::before, .date-separator::after {
  content: ''; flex: 1; height: 1px; background: var(--glass-border);
}

/* ── System Message ────────────────────────────────────────── */
.system-msg {
  text-align: center; padding: 4px 16px;
  font-size: var(--text-xs); color: var(--color-base-400);
  z-index: 1;
}

/* ── Pinned Messages Bar ───────────────────────────────────── */
.pinned-bar {
  padding: 8px 16px;
  background: rgba(102,126,234,0.05);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 8px;
  font-size: var(--text-sm); cursor: pointer;
}
.pinned-bar i { color: var(--accent-indigo); }

/* ── Drag & Drop Overlay ──────────────────────────────────── */
.drop-overlay {
  position: absolute; inset: 0;
  background: rgba(102,126,234,0.1);
  border: 2px dashed var(--accent-indigo);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-overlay);
  backdrop-filter: blur(8px);
}
.drop-overlay-text {
  font-size: var(--text-xl); font-weight: 700; color: var(--accent-indigo);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.drop-overlay-text i { font-size: 48px; }

/* ── Voice Channel Sidebar ─────────────────────────────────── */
.voice-channel-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 16px 4px 36px; font-size: var(--text-xs);
  color: var(--color-base-200); cursor: pointer;
  transition: background var(--dur-fast);
}
.voice-channel-user:hover { background: rgba(255,255,255,.03); }
.vc-user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.voice-channel-item.voice-active {
  background: rgba(16,185,129,.08) !important;
  border-left: 2px solid var(--color-success);
}

/* ── Voice Room View ───────────────────────────────────────── */
.voice-room-view {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(102,126,234,.06) 0%, var(--color-base-900) 70%);
  position: relative; overflow: hidden;
}
.voice-room-view::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(118,75,162,.05) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(102,126,234,.05) 0%, transparent 50%);
  pointer-events: none;
}
.voice-room-content {
  position: relative; z-index: 1; text-align: center;
  max-width: 600px; width: 100%; padding: 40px 24px;
}
.voice-room-header { margin-bottom: 40px; }
.voice-room-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(102,126,234,.12); margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--accent-indigo);
  border: 1px solid rgba(102,126,234,.2);
  animation: pulse 3s ease-in-out infinite;
}
.voice-room-header h2 {
  font-size: var(--text-2xl); font-weight: 800; margin-bottom: 6px;
}
.voice-room-status {
  color: var(--color-base-300); font-size: var(--text-sm);
}

/* ── Voice Room Users ──────────────────────────────────────── */
.voice-room-users {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 20px;
  margin-bottom: 40px; min-height: 80px;
  align-items: flex-start;
}
.voice-room-user {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px; border-radius: var(--radius-lg);
  background: var(--color-base-800); border: 1px solid var(--glass-border);
  min-width: 120px; transition: all var(--dur-fast) var(--ease-out);
}
.voice-room-user:hover { border-color: var(--glass-border-hover); transform: translateY(-2px); }
.voice-room-user.muted { opacity: .7; }
.voice-room-user-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  position: relative; border: 3px solid transparent;
  animation: voiceGlow 2s ease-in-out infinite;
}
.voice-room-user.muted .voice-room-user-avatar { animation: none; border-color: var(--color-base-600); }
.voice-room-user-status {
  position: absolute; bottom: 2px; right: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--color-base-800);
}
.voice-room-user-status.speaking { background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }
.voice-room-user-status.muted { background: var(--color-danger); }
.voice-room-user-name {
  font-size: var(--text-sm); font-weight: 600; color: var(--color-base-100);
}

/* ── Voice Room Actions ────────────────────────────────────── */
.voice-room-actions {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.voice-room-controls {
  display: flex; gap: 8px;
}
.voice-ctrl-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-base-700); border: 1px solid var(--glass-border);
  color: var(--color-base-100); font-size: var(--text-lg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--dur-fast) var(--ease-out);
}
.voice-ctrl-btn:hover { background: var(--color-base-600); color: #fff; border-color: var(--glass-border-hover); }
.voice-ctrl-btn.active { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }

/* ── Voice Connected Panel (sidebar) ───────────────────────── */
.voice-connected-panel {
  padding: 10px 12px;
  background: var(--color-base-800);
  border-top: 1px solid var(--glass-border);
}
.vc-panel-info { margin-bottom: 8px; }
.vc-panel-status {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
}
.vc-panel-controls {
  display: flex; gap: 4px;
}
.vc-panel-btn {
  flex: 1; height: 32px; border-radius: var(--radius-sm);
  background: var(--color-base-700); border: none;
  color: var(--color-base-200); font-size: var(--text-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--dur-fast);
}
.vc-panel-btn:hover { background: var(--color-base-600); color: #fff; }
.vc-panel-btn.active { background: rgba(239,68,68,.15); color: var(--color-danger); }
.vc-panel-btn.vc-panel-disconnect { background: rgba(239,68,68,.12); color: var(--color-danger); }
.vc-panel-btn.vc-panel-disconnect:hover { background: var(--color-danger); color: #fff; }

/* ── Voice Glow Animation ──────────────────────────────────── */
@keyframes voiceGlow {
  0%, 100% { border-color: rgba(102,126,234,.3); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  50% { border-color: rgba(16,185,129,.5); box-shadow: 0 0 12px rgba(16,185,129,.15); }
}
