/* ============================================================
   CHAT SYSTEM — Support Widget + Group Chat
   Dark Glassmorphism, matching project design system
   ============================================================ */

/* ---- Variables ---- */
:root {
  --chat-indigo: #6366f1;
  --chat-indigo-dark: #4f46e5;
  --chat-gold: #f59e0b;
  --chat-cyan: #22d3ee;
  --chat-bg: rgba(15, 15, 30, 0.97);
  --chat-surface: rgba(255, 255, 255, 0.04);
  --chat-surface-hover: rgba(255, 255, 255, 0.07);
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-text: #e2e8f0;
  --chat-muted: #94a3b8;
  --chat-radius: 20px;
  --chat-radius-sm: 12px;
  --chat-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  --chat-glow: 0 0 32px rgba(99,102,241,0.15);
}

/* ============================================================
   SUPPORT CHAT WIDGET (floating, bottom-right)
   ============================================================ */

.sc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
}

/* Toggle button */
.sc-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,0.45), var(--chat-shadow);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  position: relative;
  color: #fff;
}
.sc-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(99,102,241,0.6), var(--chat-shadow);
}
.sc-toggle svg { width: 24px; height: 24px; pointer-events: none; }
.sc-toggle .sc-icon-open  { display: flex; }
.sc-toggle .sc-icon-close { display: none; }
.sc-widget.is-open .sc-toggle .sc-icon-open  { display: none; }
.sc-widget.is-open .sc-toggle .sc-icon-close { display: flex; }

/* Unread badge */
.sc-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #0a0a1a;
  line-height: 1;
  animation: scBadgePop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.sc-badge[hidden] { display: none; }
@keyframes scBadgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* Pulse animation when there are messages */
.sc-widget.has-unread .sc-toggle::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99,102,241,0.5);
  animation: scPulse 2s ease-in-out infinite;
}
@keyframes scPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.15); }
}

/* Chat window */
.sc-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  max-height: 520px;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow), var(--chat-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform-origin: bottom right;
  transform: scale(0.88) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
.sc-widget.is-open .sc-window {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Window header */
.sc-head {
  padding: 16px 18px 14px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(34,211,238,0.08));
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sc-head-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.sc-head-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--chat-text);
}
.sc-head-info small {
  font-size: 11px;
  color: var(--chat-cyan);
}
.sc-head-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
  animation: dotPulse 2s infinite;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Messages area */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sc-messages::-webkit-scrollbar { width: 4px; }
.sc-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Empty state */
.sc-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--chat-muted);
  font-size: 13px;
  line-height: 1.6;
}
.sc-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; }

/* Message bubble */
.sc-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sc-msg.is-user { align-self: flex-end; align-items: flex-end; }
.sc-msg.is-admin { align-self: flex-start; align-items: flex-start; animation: msgIn 0.28s ease, adminPop 0.5s ease-out; }

@keyframes adminPop {
  0%   { transform: translateX(-6px) scale(0.97); }
  60%  { transform: translateX(2px) scale(1.01); }
  100% { transform: translateX(0) scale(1); }
}

.sc-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
}
.sc-msg.is-user  .sc-bubble {
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sc-msg.is-admin .sc-bubble {
  background: linear-gradient(135deg, rgba(34,211,238,0.13), rgba(99,102,241,0.08));
  border: 1px solid rgba(34,211,238,0.30);
  border-left: 3px solid var(--chat-cyan);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 14px rgba(34,211,238,0.12);
}

.sc-msg-img {
  max-width: 200px;
  border-radius: 10px;
  margin-top: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
  display: block;
}
.sc-msg-img:hover { opacity: 0.85; }

.sc-msg-time {
  font-size: 10px;
  color: var(--chat-muted);
  margin-top: 3px;
  padding: 0 2px;
}

/* Input area */
.sc-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--chat-border);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

/* Image preview */
.sc-img-preview {
  margin-bottom: 8px;
  position: relative;
  display: inline-block;
}
.sc-img-preview img {
  max-height: 80px;
  border-radius: 8px;
  display: block;
}
.sc-img-preview button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.sc-img-preview[hidden] { display: none; }

.sc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.sc-textarea {
  flex: 1;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  color: var(--chat-text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 14px;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.sc-textarea:focus { border-color: var(--chat-indigo); }
.sc-textarea::placeholder { color: var(--chat-muted); }

.sc-btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  cursor: pointer;
  color: var(--chat-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.sc-btn-icon:hover { background: var(--chat-surface-hover); color: var(--chat-text); }
.sc-btn-icon svg { width: 18px; height: 18px; }

.sc-btn-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.sc-btn-send:hover { transform: scale(1.05); box-shadow: 0 6px 18px rgba(99,102,241,0.5); }
.sc-btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.sc-btn-send svg { width: 18px; height: 18px; }

/* Group chat link in widget */
.sc-grouplink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(245,158,11,0.04));
  border-top: 1px solid rgba(245,158,11,0.15);
  color: var(--chat-gold);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s;
}
.sc-grouplink:hover { background: linear-gradient(90deg, rgba(245,158,11,0.18), rgba(245,158,11,0.06)); }
.sc-grouplink svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Mobile */
@media (max-width: 480px) {
  .sc-window {
    width: calc(100vw - 32px);
    right: 0;
  }
}

/* ============================================================
   GROUP CHAT PAGE
   ============================================================ */

.gc-page {
  min-height: 100vh;
  background: #080814;
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--chat-text);
  overflow: hidden;
}

/* Background glow */
.gc-glow-a {
  position: fixed;
  top: -200px;
  left: -150px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.gc-glow-b {
  position: fixed;
  bottom: -150px;
  right: -100px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Join Screen ---- */
.gc-join-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8,8,20,0.98);
  backdrop-filter: blur(12px);
}
.gc-join-wrap[hidden] { display: none; }

.gc-join-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(99,102,241,0.1);
  animation: joinIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes joinIn {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gc-join-header {
  text-align: center;
  margin-bottom: 28px;
}
.gc-join-header .gc-join-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(34,211,238,0.15));
  border: 1px solid rgba(99,102,241,0.3);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.gc-join-header h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--chat-text), var(--chat-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 6px;
}
.gc-join-header p {
  color: var(--chat-muted);
  font-size: 14px;
  margin: 0;
}

.gc-join-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--chat-muted);
  display: block;
  margin-bottom: 6px;
}

.gc-join-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  color: var(--chat-text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
}
.gc-join-input:focus {
  border-color: var(--chat-indigo);
  background: rgba(99,102,241,0.05);
}
.gc-join-input::placeholder { color: rgba(148,163,184,0.5); }

.gc-join-field { margin-bottom: 20px; }

/* Avatar picker */
.gc-avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.gc-avatar-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid transparent;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  line-height: 1;
}
.gc-avatar-btn:hover { background: rgba(255,255,255,0.08); transform: scale(1.1); }
.gc-avatar-btn.is-active {
  border-color: var(--chat-indigo);
  background: rgba(99,102,241,0.15);
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(99,102,241,0.35);
}

.gc-join-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  margin-top: 8px;
}
.gc-join-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(99,102,241,0.5); }
.gc-join-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ---- Chat Layout ---- */
.gc-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}
.gc-layout[hidden] { display: none; }

/* Header */
.gc-header {
  padding: 0 20px;
  height: 64px;
  background: rgba(8,8,20,0.9);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}
.gc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gc-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(34,211,238,0.1));
  border: 1px solid rgba(99,102,241,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.gc-header-info strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--chat-text);
}
.gc-header-info small {
  font-size: 12px;
  color: var(--chat-muted);
  display: block;
}
.gc-online-count {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 5px;
}
.gc-online-count::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.7);
  animation: dotPulse 2s infinite;
}
.gc-back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--chat-muted);
  text-decoration: none;
  transition: color 0.2s;
  padding: 6px 10px;
  border-radius: 8px;
}
.gc-back-link:hover { color: var(--chat-text); background: rgba(255,255,255,0.04); }
.gc-back-link svg { width: 16px; height: 16px; }

/* Messages container */
.gc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.gc-messages::-webkit-scrollbar { width: 4px; }
.gc-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* Message row */
.gc-msg-row {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  animation: msgIn 0.25s ease;
}
.gc-msg-row.is-own { flex-direction: row-reverse; }
.gc-msg-row.is-own .gc-msg-meta { text-align: right; }

/* Avatar */
.gc-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  align-self: flex-end;
}
.gc-msg-row.is-own .gc-msg-avatar { display: none; }

/* Bubble group */
.gc-msg-group { display: flex; flex-direction: column; max-width: 68%; }
.gc-msg-row.is-own .gc-msg-group { align-items: flex-end; }

.gc-msg-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--chat-muted);
  margin-bottom: 3px;
  padding: 0 4px;
}
.gc-msg-row.is-own .gc-msg-name { display: none; }

.gc-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
}
.gc-msg-row.is-own .gc-msg-bubble {
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.gc-msg-row:not(.is-own) .gc-msg-bubble {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.gc-msg-img {
  max-width: 280px;
  border-radius: 12px;
  display: block;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.2s, transform 0.2s;
}
.gc-msg-img:hover { opacity: 0.9; transform: scale(1.01); }

.gc-msg-time {
  font-size: 10.5px;
  color: var(--chat-muted);
  margin-top: 3px;
  padding: 0 4px;
}

/* Date divider */
.gc-date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  color: var(--chat-muted);
  font-size: 11.5px;
  font-weight: 600;
}
.gc-date-divider::before, .gc-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.06);
}

/* System message */
.gc-msg-system {
  text-align: center;
  font-size: 12px;
  color: var(--chat-muted);
  padding: 4px 0;
  animation: msgIn 0.25s ease;
}

/* ---- Input Area ---- */
.gc-input-area {
  padding: 14px 20px 18px;
  background: rgba(8,8,20,0.9);
  border-top: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

/* Image preview bar */
.gc-img-preview-bar {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gc-img-preview-bar[hidden] { display: none; }
.gc-img-preview-thumb {
  height: 56px;
  border-radius: 10px;
  display: block;
}
.gc-img-preview-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239,68,68,0.8);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Emoji picker */
.gc-emoji-picker {
  background: rgba(15,15,30,0.98);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.gc-emoji-picker[hidden] { display: none; }
.gc-emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.gc-emoji-btn {
  font-size: 20px;
  padding: 5px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, transform 0.15s;
  line-height: 1;
}
.gc-emoji-btn:hover { background: rgba(255,255,255,0.08); transform: scale(1.2); }

.gc-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.gc-textarea {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  color: var(--chat-text);
  font-family: inherit;
  font-size: 14px;
  padding: 11px 16px;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  line-height: 1.55;
}
.gc-textarea:focus {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.04);
}
.gc-textarea::placeholder { color: rgba(148,163,184,0.45); }

.gc-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  cursor: pointer;
  color: var(--chat-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-size: 20px;
}
.gc-btn-icon:hover {
  background: rgba(255,255,255,0.07);
  color: var(--chat-text);
  border-color: rgba(255,255,255,0.15);
}
.gc-btn-icon.is-active {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  color: var(--chat-indigo);
}
.gc-btn-icon svg { width: 20px; height: 20px; }

.gc-btn-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
.gc-btn-send:hover { transform: scale(1.06); box-shadow: 0 8px 22px rgba(99,102,241,0.5); }
.gc-btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gc-btn-send svg { width: 20px; height: 20px; }

/* ---- Image Lightbox ---- */
.gc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}
.gc-lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.gc-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.gc-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.gc-lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* Mobile responsive */
@media (max-width: 640px) {
  .gc-header { padding: 0 12px; }
  .gc-messages { padding: 12px 12px 8px; }
  .gc-input-area { padding: 10px 12px 14px; }
  .gc-msg-group { max-width: 82%; }
  .gc-emoji-grid { grid-template-columns: repeat(8, 1fr); }
  .gc-join-card { padding: 28px 20px; }
}

/* ============================================================
   ADMIN SUPPORT CHAT PANEL
   ============================================================ */

.adp-chat-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: 560px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
@media (max-width: 860px) {
  .adp-chat-panel { grid-template-columns: 1fr; height: auto; }
}

/* Sidebar - conversation list */
.adp-chat-sidebar {
  background: rgba(0,0,0,0.25);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.07) transparent;
}
.adp-chat-sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.adp-chat-sidebar-head strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--chat-text);
}
.adp-chat-sidebar-head small {
  font-size: 11px;
  color: var(--chat-muted);
}

.adp-chat-conv {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adp-chat-conv:hover { background: rgba(255,255,255,0.04); }
.adp-chat-conv.is-active { background: rgba(99,102,241,0.1); border-left: 2px solid var(--chat-indigo); }

.adp-chat-conv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.adp-chat-conv-ip {
  font-size: 12px;
  font-weight: 700;
  color: var(--chat-text);
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.adp-chat-conv-time {
  font-size: 10px;
  color: var(--chat-muted);
  flex-shrink: 0;
}
.adp-chat-conv-preview {
  font-size: 12px;
  color: var(--chat-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adp-chat-unread {
  background: var(--chat-indigo);
  color: #fff;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.adp-chat-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--chat-muted);
  font-size: 13px;
}

/* Main chat area */
.adp-chat-main {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.1);
  overflow: hidden;
}

.adp-chat-main-head {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.adp-chat-main-head strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--chat-text);
  font-family: monospace;
}
.adp-chat-main-head small {
  font-size: 11px;
  color: var(--chat-muted);
}

.adp-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.07) transparent;
}

.adp-chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--chat-muted);
  font-size: 13px;
}
.adp-chat-placeholder svg { opacity: 0.25; }

/* Admin messages */
.adp-chat-msg { display: flex; flex-direction: column; }
.adp-chat-msg.is-user { align-items: flex-start; }
.adp-chat-msg.is-admin { align-items: flex-end; }
.adp-chat-msg-bubble {
  padding: 8px 14px;
  border-radius: 14px;
  max-width: 75%;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  animation: msgIn 0.2s ease;
}
.adp-chat-msg.is-user .adp-chat-msg-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}
.adp-chat-msg.is-admin .adp-chat-msg-bubble {
  background: linear-gradient(135deg, rgba(99,102,241,0.4), rgba(79,70,229,0.35));
  border: 1px solid rgba(99,102,241,0.25);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.adp-chat-msg-img {
  max-width: 200px;
  border-radius: 8px;
  display: block;
  margin-top: 4px;
  cursor: pointer;
}
.adp-chat-msg-meta {
  font-size: 10.5px;
  color: var(--chat-muted);
  margin-top: 2px;
  padding: 0 2px;
}
.adp-chat-msg.is-admin .adp-chat-msg-meta { text-align: right; }

/* Reply input */
.adp-chat-reply {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.adp-chat-reply-textarea {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  color: var(--chat-text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  resize: none;
  min-height: 38px;
  max-height: 80px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.adp-chat-reply-textarea:focus { border-color: rgba(99,102,241,0.4); }
.adp-chat-reply-textarea::placeholder { color: rgba(148,163,184,0.4); }

.adp-chat-reply-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--chat-indigo), var(--chat-indigo-dark));
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.adp-chat-reply-btn:hover { transform: translateY(-1px); }
.adp-chat-reply-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Image upload in admin */
.adp-chat-img-preview {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
}
.adp-chat-img-preview[hidden] { display: none; }
.adp-chat-img-preview img { height: 48px; border-radius: 6px; }
.adp-chat-img-preview button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239,68,68,0.8);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
