/* ==========================================================================
   ChatX2 — Clean Flat Icons, Buttons & Textboxes CSS (Zero Shadows)
   ========================================================================== */

button,
input,
textarea {
  font-family: inherit;
}

.form-control:focus,
.btn:focus,
.btn:active:focus {
  box-shadow: none !important;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Logo & Profile Actions
   -------------------------------------------------------------------------- */
.chat-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 52%, #06b6d4 100%);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: none;
}

.chat-logo-badge.sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.chat-logo-badge svg {
  display: block;
}

.brand-title-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.profile-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: none;
}

[data-theme="light"] .profile-actions {
  background: rgba(15, 23, 42, 0.035);
}

.profile-actions .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 13px;
}

.profile-actions .icon-btn:hover {
  background: var(--surface-hover);
  border-color: transparent;
}

.profile-actions .icon-btn.danger:hover {
  background: rgba(244, 63, 94, 0.14);
  color: var(--danger);
}

/* CSS-driven SVG Icon States (Sound & Theme, zero emojis) */
#sound-btn .icon-sound-off { display: none; }
#sound-btn.is-muted .icon-sound-on { display: none; }
#sound-btn.is-muted .icon-sound-off { display: block; color: var(--danger); }

#theme-btn .icon-sun { display: none; }
[data-theme="light"] #theme-btn .icon-moon { display: none; }
[data-theme="light"] #theme-btn .icon-sun { display: block; }

/* --------------------------------------------------------------------------
   Textboxes & Inputs
   -------------------------------------------------------------------------- */
.password-field input,
.modal-form input {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.modal-form input {
  padding: 0 14px;
}

[data-theme="light"] .password-field input,
[data-theme="light"] .modal-form input {
  background: rgba(15, 23, 42, 0.03);
}

.password-field input::placeholder,
.modal-form input::placeholder,
.composer textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.password-field input:hover,
.modal-form input:hover {
  border-color: rgba(161, 161, 170, 0.35);
}

.password-field input:focus,
.modal-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: none;
}

/* Message Composer */
.composer {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 10px;
  border-radius: 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  box-shadow: none;
  transition: border-color 0.2s ease;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: none;
}

.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 8px 6px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  resize: none;
  outline: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Primary, Secondary & Send Buttons
   -------------------------------------------------------------------------- */
.primary-btn {
  height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: none;
  transition: transform 0.12s ease, filter 0.16s ease;
}

.primary-btn:hover {
  filter: brightness(1.08);
  color: #ffffff;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.985);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.secondary-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(161, 161, 170, 0.35);
  color: var(--text);
}

.secondary-btn:active {
  transform: scale(0.97);
}

.send-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 13px;
  border: none;
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.send-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.send-btn:hover {
  filter: brightness(1.1);
  color: #ffffff;
}

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

/* --------------------------------------------------------------------------
   Icon Buttons (Centered, Crisp, Zero Shadows)
   -------------------------------------------------------------------------- */
.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.icon-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.93);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.25);
  background: rgba(244, 63, 94, 0.12);
}

.profile-name {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px 2px 0;
  border-radius: 6px;
  cursor: pointer;
  max-width: 100%;
  transition: color 0.15s ease;
}

.profile-name svg {
  display: block;
  flex-shrink: 0;
}

.profile-name:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Channel / Room Buttons & Floating Controls
   -------------------------------------------------------------------------- */
.room-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.room-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.room-item:active {
  transform: scale(0.985);
}

.room-item.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.28);
  color: var(--text);
  font-weight: 600;
}

.vip-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: var(--warning);
}

.vip-lock-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.room-item.vip-unlocked .vip-lock-icon {
  display: none;
}

.room-item.vip-locked {
  opacity: 0.65;
}

.vip-crown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: none;
}

.vip-crown svg {
  display: block;
  width: 13px;
  height: 13px;
}

.online-list {
  padding-left: 0;
  margin: 0;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 11px;
  font-size: 13.5px;
}

.online-user-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scroll-bottom-btn {
  position: absolute;
  bottom: 92px;
  right: 28px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  z-index: 15;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.scroll-bottom-btn:hover {
  filter: brightness(1.08);
  color: #ffffff;
  transform: translateY(-1px);
}

.scroll-bottom-btn:active {
  transform: scale(0.96);
}

.emoji-popover {
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 4px !important;
  padding: 10px !important;
  width: 248px;
}

.emoji-popover button {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msg-bubble.emoji-only {
  background: transparent !important;
  border-color: transparent !important;
  padding: 2px 4px;
  font-size: 38px;
  line-height: 1.15;
}

.quick-react-bar button,
.emoji-popover button {
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1;
  transition: background 0.12s ease, transform 0.1s ease;
}

.quick-react-bar button {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-react-bar button:hover,
.emoji-popover button:hover {
  background: var(--surface-hover);
  transform: scale(1.1);
}

.reaction-chip {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.reaction-chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.reaction-chip.mine {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
}

/* Reply-to Preview & Message Quote */
.reply-preview {
  max-width: 900px;
  margin: 0 auto 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: none;
}

.reply-preview-bar {
  width: 3px;
  align-self: stretch;
  min-height: 28px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

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

.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.3;
}

.reply-preview-text {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.msg-reply-quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: normal;
  max-width: 100%;
  min-width: 0;
}

.msg-row:not(.me) .msg-reply-quote {
  border-left-color: var(--accent);
  background: rgba(99, 102, 241, 0.09);
}

[data-theme="light"] .msg-row:not(.me) .msg-reply-quote {
  background: rgba(79, 70, 229, 0.07);
}

.msg-reply-author {
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.25;
  opacity: 0.95;
}

.msg-reply-snippet {
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.quick-react-bar .msg-action-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-muted);
  border-radius: 999px;
}

.quick-react-bar .msg-action-btn:first-of-type {
  margin-left: 2px;
}

.quick-react-bar .msg-action-btn svg {
  display: block;
  pointer-events: none;
}

.quick-react-bar .msg-action-btn:hover {
  color: var(--text);
}

.msg-edited-tag {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  opacity: 0.85;
}

.msg-row.me .msg-edited-tag {
  color: rgba(255, 255, 255, 0.78);
}

.modal-form textarea {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  box-shadow: none;
}

[data-theme="light"] .modal-form textarea {
  background: rgba(15, 23, 42, 0.03);
}

.modal-form textarea:focus {
  border-color: var(--accent);
}

.quick-react-bar .msg-action-btn.delete:hover {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Channel Message Search Bar & Results Panel (Zero Shadows)
   -------------------------------------------------------------------------- */
.search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 220px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 0 30px 0 32px;
  transition: border-color 0.18s ease, width 0.2s ease, background 0.18s ease;
}

[data-theme="light"] .search-box {
  background: rgba(15, 23, 42, 0.04);
}

.search-box:focus-within {
  width: 260px;
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-shadow: none;
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.search-mobile-btn {
  display: none;
}

.search-results {
  position: absolute;
  top: 72px;
  right: 20px;
  width: min(400px, calc(100% - 24px));
  max-height: 380px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: none;
  z-index: 35;
  overflow: hidden;
}

.search-results-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.search-results-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.search-result-item:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.search-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.search-result-author {
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.search-result-body {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.search-hit {
  background: rgba(99, 102, 241, 0.28);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}

.search-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.msg-row.msg-highlight .msg-bubble {
  border-color: var(--accent);
  outline: 2px solid rgba(99, 102, 241, 0.45);
}

@media (max-width: 680px) {
  .search-box {
    display: none;
  }
  .search-box.mobile-open,
  .search-box.mobile-open:focus-within {
    display: inline-flex;
    position: absolute;
    left: 12px;
    right: 12px;
    top: 11px;
    width: auto;
    z-index: 25;
    background: var(--surface-solid);
  }
  .search-mobile-btn {
    display: inline-flex;
  }
  .search-results {
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* --------------------------------------------------------------------------
   Clickable Links, Unread Badges & Voice Recording UI
   -------------------------------------------------------------------------- */
.msg-link {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.msg-row.me .msg-link {
  color: #ffffff;
}

.unread-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  animation: badgePop 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes badgePop {
  from { transform: scale(0.75); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.room-item[data-vip="1"] .unread-badge {
  margin-left: 4px;
}

.count-pill,
.latency-badge,
.attach-count {
  font-variant-numeric: tabular-nums;
}

.voice-btn.recording {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.voice-recording-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.32);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recPulse 1s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.voice-timer {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--danger);
  margin-right: auto;
}

/* Custom Modern Voice Message Player */
.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(230px, 64vw);
  max-width: min(290px, 72vw);
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.msg-row:not(.me) .voice-player {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .msg-row:not(.me) .voice-player {
  background: rgba(15, 23, 42, 0.05);
}

.voice-play-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.msg-row:not(.me) .voice-play-btn {
  background: var(--accent);
  color: #ffffff;
}

.voice-play-btn:hover {
  transform: scale(1.06);
}

.voice-play-btn:active {
  transform: scale(0.94);
}

.voice-play-btn svg {
  display: block;
  pointer-events: none;
}

.voice-wave {
  flex: 1;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 2.5px;
  cursor: pointer;
  min-width: 0;
}

.voice-bar {
  flex: 1;
  min-width: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.12s ease;
}

.msg-row:not(.me) .voice-bar {
  background: rgba(161, 161, 170, 0.38);
}

.voice-bar.played {
  background: #ffffff;
}

.msg-row:not(.me) .voice-bar.played {
  background: var(--accent);
}

.voice-duration {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Pinned Announcement Banner (Zero Shadows)
   -------------------------------------------------------------------------- */
.pinned-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid #f59e0b;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.pinned-banner:hover {
  background: rgba(245, 158, 11, 0.06);
}

.pinned-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pinned-content {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 2px 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.pinned-author {
  font-size: 11.5px;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.pinned-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-react-bar .msg-action-btn.pin.is-pinned {
  color: #f59e0b;
}

@media (max-width: 680px) {
  .pinned-banner {
    padding: 8px 12px;
    gap: 8px;
  }
}

/* --------------------------------------------------------------------------
   User Status Dots & Custom Status Picker (Online / Busy / Away, Zero Shadows)
   -------------------------------------------------------------------------- */
.avatar.online::after,
.avatar.busy::after,
.avatar.away::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface-solid);
}
.avatar.online::after { background: var(--success); }
.avatar.busy::after { background: var(--danger); }
.avatar.away::after { background: var(--warning); }

.status-picker {
  position: relative;
  display: inline-block;
  margin-top: 2px;
}

.status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

[data-theme="light"] .status-btn {
  background: rgba(15, 23, 42, 0.04);
}

.status-btn:hover {
  color: var(--text);
  border-color: rgba(161, 161, 170, 0.35);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); }
.status-dot.busy { background: var(--danger); }
.status-dot.away { background: var(--warning); }

.status-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 130px;
  padding: 5px;
  border-radius: 13px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 35;
  box-shadow: none;
}

.status-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.status-option:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.status-option.active {
  background: rgba(99, 102, 241, 0.14);
  color: var(--text);
}

.online-user-status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: capitalize;
  flex-shrink: 0;
}

.online-user-status.busy {
  background: rgba(244, 63, 94, 0.14);
  color: var(--danger);
}

.online-user-status.away {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* --------------------------------------------------------------------------
   In-App Admin Panel Modal (Zero Shadows)
   -------------------------------------------------------------------------- */
.admin-modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 86dvh;
  padding: 20px;
  border-radius: 20px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  box-shadow: none;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.admin-create-form .form-control {
  height: 38px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  box-shadow: none;
}

[data-theme="light"] .admin-create-form .form-control {
  background: rgba(15, 23, 42, 0.03);
}

.admin-vip-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--warning);
  cursor: pointer;
  padding: 0 4px;
}

.admin-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.admin-users-list {
  flex: 1;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

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

.admin-user-name {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-user-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.admin-user-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.admin-mini-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.admin-mini-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.admin-mini-btn.vip-on {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
}

.admin-mini-btn.danger:hover {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.14);
  color: var(--danger);
}

.admin-mini-btn.muted-on {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.14);
  color: var(--danger);
}

.muted-composer-banner {
  max-width: 900px;
  margin: 0 auto 8px;
  padding: 9px 14px;
  border-radius: 14px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.1);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.composer.is-muted {
  opacity: 0.55;
  pointer-events: none;
}

.admin-clear-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-clear-btn {
  height: 34px;
  font-size: 12.5px;
}

.admin-clear-btn.confirming {
  border-color: var(--danger);
  background: rgba(244, 63, 94, 0.14);
  color: var(--danger);
}

.admin-channel-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.admin-channel-form .form-control {
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  box-shadow: none;
}

[data-theme="light"] .admin-channel-form .form-control {
  background: rgba(15, 23, 42, 0.03);
}

.admin-channels-list {
  max-height: 170px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.admin-channel-name {
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   @Mention Highlighting & Read Receipts (Seen)
   -------------------------------------------------------------------------- */
.msg-mention {
  display: inline-block;
  padding: 0 5px;
  border-radius: 6px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.16);
  color: #818cf8;
}

.msg-row.me .msg-mention {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.msg-mention.me {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}

[data-theme="light"] .msg-row:not(.me) .msg-mention {
  color: #4f46e5;
}

[data-theme="light"] .msg-row:not(.me) .msg-mention.me {
  color: #b45309;
}

.msg-row.mentioned .msg-bubble {
  border-color: rgba(245, 158, 11, 0.45);
}

.online-user {
  cursor: pointer;
}

.online-user:hover {
  background: var(--surface-hover);
}

/* --------------------------------------------------------------------------
   Shortcut Cheat-Sheet & Full Mobile/All-Screen Responsiveness
   -------------------------------------------------------------------------- */
.shortcuts-card {
  max-width: 420px;
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
}

.shortcut-row kbd {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  white-space: nowrap;
}

.shortcut-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* Tap-to-open message actions on mobile & touch devices */
.msg-content.actions-open .quick-react-bar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 780px) {
  .modal-card,
  .admin-modal-card,
  .media-modal-card {
    max-height: 90dvh;
    overflow-y: auto;
  }

  .quick-react-bar {
    max-width: calc(100vw - 32px);
    flex-wrap: wrap;
    border-radius: 16px;
  }

  .emoji-popover {
    width: min(248px, calc(100vw - 28px));
  }

  .composer {
    padding: 6px 8px;
    gap: 5px;
  }

  .attach-preview {
    padding: 6px 8px;
  }
}

@media (max-width: 400px) {
  .chat-header {
    padding: 0 8px;
  }
  .header-left {
    gap: 6px;
    min-width: 0;
  }
  .room-title-wrap h2 {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 125px;
  }
  .room-subtitle {
    display: none;
  }
}

@media (max-width: 680px) {
  .admin-create-form {
    grid-template-columns: 1fr 1fr;
  }
  .admin-create-form .primary-btn {
    grid-column: 1 / -1;
  }
  .admin-user-row {
    flex-wrap: wrap;
  }
}

/* --------------------------------------------------------------------------
   Drag & Drop, Attachment Preview & 1x View-Once Controls
   -------------------------------------------------------------------------- */
.drop-overlay {
  position: absolute;
  inset: 12px;
  border-radius: 20px;
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px dashed var(--accent);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
  pointer-events: none;
}

[data-theme="light"] .drop-overlay {
  background: rgba(248, 250, 252, 0.85);
}

.drop-box {
  width: 100%;
  max-width: 360px;
  padding: 28px 22px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  text-align: center;
}

.drop-box svg {
  color: var(--accent);
}

.attach-preview {
  max-width: 900px;
  margin: 0 auto 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.attach-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
}

.attach-item {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.attach-item img,
.attach-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-item-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(9, 9, 11, 0.78);
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.attach-item-remove:hover {
  background: var(--danger);
}

.attach-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.attach-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.view-once-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.view-once-btn:hover {
  color: var(--text);
}

.view-once-btn .vo-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px dashed currentColor;
  font-size: 10px;
  font-weight: 700;
}

.view-once-btn.active {
  border-color: var(--accent-2);
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-2);
}

/* Inline Media & 1x View-Once Message Bubble */
.msg-bubble.media-only {
  padding: 5px;
  border-radius: 16px;
}

.msg-bubble.has-media {
  padding: 6px;
  border-radius: 16px;
}

.msg-media-caption {
  padding: 6px 8px 3px;
  font-size: 14px;
  line-height: 1.45;
}

.msg-media-wrap {
  overflow: hidden;
  border-radius: 12px;
}

.msg-media-img,
.msg-media-video {
  display: block;
  width: 100%;
  max-width: min(300px, 72vw);
  max-height: 280px;
  border-radius: 12px;
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.16s ease;
}

.msg-media-img:hover {
  transform: scale(1.01);
}

.msg-file-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  color: inherit;
  text-decoration: none;
  max-width: min(290px, 72vw);
  transition: background 0.15s ease;
}

.msg-row:not(.me) .msg-file-card {
  background: rgba(99, 102, 241, 0.08);
}

.msg-file-card:hover {
  background: rgba(0, 0, 0, 0.24);
  color: inherit;
}

.msg-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-file-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-file-icon {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.view-once-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

[data-theme="light"] .msg-row:not(.me) .view-once-pill {
  background: rgba(15, 23, 42, 0.05);
}

.view-once-pill:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.14);
}

.view-once-pill:not(:disabled):active {
  transform: scale(0.98);
}

.view-once-pill.opened {
  opacity: 0.65;
  cursor: default;
}

.view-once-pill .vo-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px dashed currentColor;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Lightbox Modal */
.media-modal-card {
  width: 100%;
  max-width: 780px;
  padding: 16px;
  border-radius: 20px;
  box-shadow: none;
}

.media-modal-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.media-modal-body {
  display: grid;
  place-items: center;
  max-height: 75dvh;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}

.media-modal-body img,
.media-modal-body video {
  max-width: 100%;
  max-height: 75dvh;
  border-radius: 12px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* --------------------------------------------------------------------------
   Anti-Capture / Privacy Curtain & Print Protection
   -------------------------------------------------------------------------- */
.media-modal-body {
  position: relative;
}

.media-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0.22;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  transform: rotate(-24deg);
  text-transform: uppercase;
  user-select: none;
}

.privacy-curtain {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  z-index: 9999;
  color: var(--text);
}

body.privacy-obscured #chat-view,
body.privacy-obscured #media-modal {
  filter: blur(24px);
}

@media print {
  html, body {
    display: none !important;
  }
}
