/* ============================================================
   TechChat — Modern Tech Style
   ============================================================ */

:root {
  --bg-deep: #0a0e1a;
  --bg-dark: #0f1421;
  --bg-card: rgba(20, 27, 45, 0.6);
  --bg-card-solid: #141b2d;
  --bg-hover: rgba(0, 245, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 245, 255, 0.3);

  --cyan: #00f5ff;
  --purple: #a855f7;
  --pink: #ec4899;
  --green: #10b981;
  --red: #f43f5e;
  --orange: #f59e0b;

  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #64748b;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --glass-blur: blur(20px);
  --shadow-glow: 0 0 30px rgba(0, 245, 255, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 245, 255, 0.3); }


/* ============================================================
   Auth Page
   ============================================================ */
.auth-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 8s ease-in-out infinite;
}
.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
  top: -100px; left: -50px;
}
.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, var(--purple), transparent 70%);
  bottom: -80px; right: -50px;
  animation-delay: 2s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--pink), transparent 70%);
  top: 40%; left: 50%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 420px;
  max-width: 90vw;
  padding: 40px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.auth-header { text-align: center; margin-bottom: 32px; }

.auth-logo {
  display: inline-flex;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px rgba(0, 245, 255, 0.4));
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s;
}
.auth-tab.active {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(168, 85, 247, 0.15));
  color: var(--text);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.1);
}

.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.active { display: flex; }

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: all 0.25s;
}
.input-group input::placeholder { color: var(--text-faint); }
.input-group input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.1);
  background: rgba(0, 0, 0, 0.4);
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  text-align: center;
}

.btn-primary {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #0a0e1a;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 1px;
}
.btn-primary:hover {
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.4);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 10px 18px; font-size: 13px; }


/* ============================================================
   Chat Page Layout
   ============================================================ */
.chat-page {
  display: flex;
  height: 100vh;
  background: var(--bg-deep);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
}

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

.sidebar-user-info { flex: 1; display: flex; flex-direction: column; }
.sidebar-username { font-weight: 600; font-size: 15px; }
.sidebar-status { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--cyan);
}

.sidebar-tabs {
  display: flex;
  padding: 8px;
  gap: 4px;
}

.side-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.side-tab.active {
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyan);
}
.side-tab:hover:not(.active) { background: rgba(255, 255, 255, 0.04); }

.side-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.panel-actions {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover {
  border-color: var(--border-glow);
  color: var(--cyan);
  background: var(--bg-hover);
}

.room-list, .contact-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.room-item:hover { background: rgba(255, 255, 255, 0.04); }
.room-item.active {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(168, 85, 247, 0.08));
  border: 1px solid var(--border-glow);
}

.room-item-info { flex: 1; min-width: 0; }
.room-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-item-last {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.room-item-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-group { background: rgba(0, 245, 255, 0.15); color: var(--cyan); }
.badge-private { background: rgba(168, 85, 247, 0.15); color: var(--purple); }

.contacts-search { padding: 10px 12px; }
.contacts-search input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.contacts-search input:focus { border-color: var(--border-glow); }

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.contact-item:hover { background: rgba(255, 255, 255, 0.04); }
.contact-item-info { flex: 1; }
.contact-item-name { font-size: 14px; font-weight: 500; }
.contact-item-status { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }


/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #0a0e1a;
  flex-shrink: 0;
  position: relative;
}
.avatar-sm { width: 38px; height: 38px; font-size: 14px; }
.avatar-xs { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

/* Uploaded avatar image fills the circle, frame glow shows around it */
.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-ring {
  position: relative;
}
.avatar-ring::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--green);
  opacity: 0.6;
}


/* ============================================================
   Chat Area
   ============================================================ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  position: relative;
}

.chat-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(0, 245, 255, 0.04), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.04), transparent 50%);
  pointer-events: none;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.chat-empty h2 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.chat-empty p { color: var(--text-dim); font-size: 15px; }
.empty-icon { opacity: 0.4; }

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-height: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 33, 0.6);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.chat-header-info { display: flex; align-items: center; gap: 12px; }
.chat-header-info h3 { font-size: 16px; font-weight: 600; }
.chat-meta { font-size: 12px; color: var(--text-dim); }


/* ============================================================
   Message List
   ============================================================ */
.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.message-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.message-group:first-child { margin-top: 0; }

.message-group.own { flex-direction: row-reverse; }

.message-group-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 65%;
}
.message-group.own .message-group-content { align-items: flex-end; }

.message-sender {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 4px;
  margin-bottom: 2px;
}
.message-group.own .message-sender { display: none; }

.message-bubble {
  padding: 10px 16px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.message-bubble.own {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.12), rgba(168, 85, 247, 0.12));
  border-color: rgba(0, 245, 255, 0.2);
}
.message-bubble.emoji-only {
  font-size: 36px;
  background: transparent;
  border: none;
  padding: 4px 8px;
}

.message-time {
  font-size: 11px;
  color: var(--text-faint);
  margin: 2px 4px 0;
}

.system-msg {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 6px 16px;
  margin: 8px auto;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  align-self: center;
}


/* ============================================================
   Message Input
   ============================================================ */
.message-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(15, 20, 33, 0.6);
  backdrop-filter: blur(10px);
  position: relative;
  flex-shrink: 0;
}

.emoji-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.emoji-trigger:hover { color: var(--orange); background: rgba(245, 158, 11, 0.1); }
.emoji-trigger.active { color: var(--orange); background: rgba(245, 158, 11, 0.15); }

#message-input {
  flex: 1;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: all 0.25s;
}
#message-input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.08);
}

.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #0a0e1a;
  cursor: pointer;
  transition: all 0.25s;
  flex-shrink: 0;
}
.btn-send:hover { box-shadow: 0 0 16px rgba(0, 245, 255, 0.4); transform: scale(1.05); }
.btn-send:active { transform: scale(1); }


/* ============================================================
   Emoji Picker
   ============================================================ */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 20px;
  width: 340px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  z-index: 100;
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.emoji-categories {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 4px;
}
.emoji-cat {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.emoji-cat:hover { background: var(--bg-hover); }
.emoji-cat.active { background: rgba(0, 245, 255, 0.1); }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 22px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
  border: none;
  background: transparent;
}
.emoji-item:hover { background: var(--bg-hover); transform: scale(1.2); }


/* ============================================================
   Members Panel
   ============================================================ */
.members-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 15px; font-weight: 600; }

.member-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.member-item:hover { background: rgba(255, 255, 255, 0.04); }
.member-item-info { flex: 1; }
.member-item-name { font-size: 14px; font-weight: 500; }
.member-item-role { font-size: 11px; color: var(--cyan); }


/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 420px;
  max-width: 90vw;
  padding: 28px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: pop 0.2s ease;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  margin-bottom: 16px;
}
.modal input:focus { border-color: var(--border-glow); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.15s;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-info { display: flex; align-items: center; gap: 10px; }
.search-result-name { font-size: 14px; font-weight: 500; }


/* ============================================================
   Toast
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.25s ease;
  max-width: 340px;
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
.toast.info { border-left-color: var(--cyan); }

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


/* ============================================================
   Form helpers
   ============================================================ */
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
}
.form-input-small {
  width: 100px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.form-input-small:focus { border-color: var(--border-glow); }


/* ============================================================
   Modal large / Admin Panel
   ============================================================ */
.modal-lg {
  width: 680px;
  max-width: 94vw;
  max-height: 88vh;
  overflow-y: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-header .modal-title { margin-bottom: 0; }

.admin-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 120px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
}
.admin-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s;
}
.admin-tab.active {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.15), rgba(168, 85, 247, 0.15));
  color: var(--text);
}

.admin-codes-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.codes-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.codes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.codes-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card-solid);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.codes-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.codes-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.code-text {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.5px;
}
.code-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.code-status.unused { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.code-status.used { background: rgba(100, 116, 139, 0.15); color: var(--text-faint); }


/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { width: 260px; }
  .members-panel { display: none; }
  .message-group-content { max-width: 80%; }
  .emoji-picker { width: 300px; }
}
@media (max-width: 560px) {
  .sidebar {
    width: 100%;
    position: absolute;
    z-index: 10;
    height: 100%;
  }
  .chat-area { width: 100%; }
  .emoji-picker { width: 280px; left: 10px; }
}


/* ============================================================
   Avatar Frames (customizable)
   ============================================================ */
.avatar-frame-cyan {
  box-shadow: 0 0 0 3px var(--cyan), 0 0 12px rgba(0, 245, 255, 0.5);
}
.avatar-frame-purple {
  box-shadow: 0 0 0 3px var(--purple), 0 0 12px rgba(168, 85, 247, 0.5);
}
.avatar-frame-gold {
  box-shadow: 0 0 0 3px #fbbf24, 0 0 12px rgba(251, 191, 36, 0.5);
}
.avatar-frame-pink {
  box-shadow: 0 0 0 3px var(--pink), 0 0 12px rgba(236, 72, 153, 0.5);
}
.avatar-frame-green {
  box-shadow: 0 0 0 3px var(--green), 0 0 12px rgba(16, 185, 129, 0.5);
}
.avatar-frame-rainbow {
  animation: frameRainbow 3s linear infinite;
}
@keyframes frameRainbow {
  0%   { box-shadow: 0 0 0 3px #00f5ff, 0 0 12px rgba(0, 245, 255, 0.5); }
  33%  { box-shadow: 0 0 0 3px #a855f7, 0 0 12px rgba(168, 85, 247, 0.5); }
  66%  { box-shadow: 0 0 0 3px #ec4899, 0 0 12px rgba(236, 72, 153, 0.5); }
  100% { box-shadow: 0 0 0 3px #00f5ff, 0 0 12px rgba(0, 245, 255, 0.5); }
}
/* Hide the default green friend ring when a custom frame is active */
.avatar.avatar-frame-cyan.avatar-ring::after,
.avatar.avatar-frame-purple.avatar-ring::after,
.avatar.avatar-frame-gold.avatar-ring::after,
.avatar.avatar-frame-pink.avatar-ring::after,
.avatar.avatar-frame-green.avatar-ring::after,
.avatar.avatar-frame-rainbow.avatar-ring::after {
  display: none;
}

.avatar-clickable { cursor: pointer; transition: transform 0.2s; }
.avatar-clickable:hover { transform: scale(1.06); }


/* ============================================================
   Contacts / Friends
   ============================================================ */
.tab-badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

.contact-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 12px 6px;
}

.contact-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-mini {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-mini:hover { background: var(--bg-hover); }
.btn-add { color: var(--cyan); border-color: rgba(0, 245, 255, 0.3); }
.btn-add:hover { background: rgba(0, 245, 255, 0.12); }
.btn-chat:hover { color: var(--cyan); }
.btn-block:hover, .btn-del:hover { background: rgba(244, 63, 94, 0.12); color: var(--red); }
.btn-accept { color: var(--green); border-color: rgba(16, 185, 129, 0.3); }
.btn-accept:hover { background: rgba(16, 185, 129, 0.12); }
.btn-reject:hover { background: rgba(100, 116, 139, 0.15); }
.btn-unblock { color: var(--cyan); }

.pending-label { font-size: 12px; color: var(--text-faint); }


/* ============================================================
   Members panel extras
   ============================================================ */
.member-section-title {
  font-size: 12px;
  color: var(--text-faint);
  padding: 4px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.member-manage-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  flex-wrap: wrap;
}
.role-badge {
  font-size: 10px;
  background: rgba(0, 245, 255, 0.15);
  color: var(--cyan);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}


/* ============================================================
   Weak password hint
   ============================================================ */
.pw-hint {
  font-size: 12px;
  margin-top: 6px;
  min-height: 16px;
  line-height: 1.4;
}
.pw-hint.weak { color: var(--orange); }
.pw-hint.ok { color: var(--green); }


/* ============================================================
   Avatar frame picker
   ============================================================ */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.frame-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.frame-option:hover { background: var(--bg-hover); }
.frame-option.active {
  border-color: var(--border-glow);
  background: rgba(0, 245, 255, 0.08);
}
.frame-option .frame-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ============================================================
   Personalization modal (avatar / background upload)
   ============================================================ */
.perso-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.perso-section:first-of-type { border-top: none; }
.perso-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 600;
}
.perso-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.perso-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.perso-hint {
  font-size: 12px;
  color: var(--text-faint);
}
.bg-preview {
  width: 96px;
  height: 60px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #0f1421, #1a2236);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}


/* ============================================================
   Group announcement banner
   ============================================================ */
.announcement-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 20px 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(168, 85, 247, 0.10));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.announcement-icon { font-size: 16px; line-height: 1.5; flex-shrink: 0; }
.announcement-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}


/* ============================================================
   Image messages, recall, modal textarea
   ============================================================ */
.message-image {
  max-width: 240px;
  max-height: 320px;
  border-radius: 10px;
  cursor: pointer;
  display: block;
  object-fit: cover;
}
.message-image-error {
  font-size: 12px;
  color: var(--text-faint);
  padding: 8px 4px;
}
.message-bubble.recalled {
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  padding: 4px 10px;
}
.message-recall-btn {
  display: none;
  font-size: 11px;
  color: var(--text-faint);
  cursor: pointer;
  margin: 2px 4px 0;
  user-select: none;
}
.message-recall-btn:hover { color: var(--red); }
.message-group:hover .message-recall-btn { display: inline; }

.modal textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  margin-bottom: 16px;
}
.modal textarea:focus { border-color: var(--border-glow); }
.modal textarea:disabled { opacity: 0.7; cursor: not-allowed; }

