/* ═══════════════════════════════════════════════════════════
   MAIN CSS — Authentic Discord Dark Theme Aesthetic
   Discord Color Palette: #313338 (Chat), #2b2d31 (Sidebar/Members),
   #232428 (User Bar), #383a40 (Inputs), #5865f2 (Blurple Accent)
═══════════════════════════════════════════════════════════ */
:root {
  /* Discord Charcoal & Blurple Theme */
  --bg-darkest: #313338; /* Main Chat Canvas Background */
  --bg-darker:  #2b2d31; /* Left & Right Sidebars Background */
  --bg-dark:    #383a40; /* Inputs & Secondary Surface */
  --bg-light:   #404249; /* Card Surface & Active Item */
  --bg-user-bar: #232428; /* Bottom Left User Footer Bar */

  --bg-hover:   rgba(255, 255, 255, 0.06);
  --bg-active:  rgba(255, 255, 255, 0.12);

  --accent-primary: #5865f2; /* Discord Blurple */
  --accent-gradient: linear-gradient(135deg, #5865f2, #4752c4);
  --accent-hover:   #4752c4;
  --accent-glow:    rgba(88, 101, 242, 0.35);

  --text-main:  #f2f3f5; /* Primary crisp text */
  --text-muted: #949ba4; /* Discord slate text */
  --text-dark:  #80848e; /* Muted icons & labels */

  --border-color: #1f2023; /* Crisp dark border */
  --border-light: rgba(255, 255, 255, 0.08);

  --status-online:    #23a55a; /* Discord online green */
  --status-away:      #f0b232; /* Discord idle yellow */
  --status-dnd:       #f23f43; /* Discord DND red */
  --status-offline:   #80848e;

  --sidebar-width: 250px;
  --right-sidebar-width: 240px;
  --topbar-height: 48px;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
}

/* Custom Scrollbar to replace the ugly Windows default */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

body {
  font-family: 'gg sans', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-darkest);
  color: var(--text-main);
  user-select: none;
  touch-action: manipulation;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  height: 100%;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Sidebar Left (Telegram Desktop Navy Theme) */
.sidebar-left {
  width: var(--sidebar-width);
  background-color: #17212b;
  border-right: 1px solid #242f3d;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #242f3d;
  background-color: #17212b;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.sidebar-logo-icon {
  color: #5288c1;
  display: flex;
  align-items: center;
}

.sidebar-search {
  padding: 0.6rem 0.75rem 0.4rem 0.75rem;
  position: relative;
}

.sidebar-search input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 0.75rem;
  background: #242f3d;
  border: 1px solid transparent;
  border-radius: 20px;
  color: #ffffff;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.sidebar-search input::placeholder {
  color: #7f91a4;
}

.sidebar-search input:focus {
  outline: none;
  background: #0e1621;
  border-color: #2b5278;
}

.sidebar-section {
  padding: 0.35rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-header {
  padding: 0.65rem 0.85rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #7f91a4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-btn {
  background: none;
  border: none;
  color: #7f91a4;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.section-btn:hover { color: #ffffff; background: rgba(255,255,255,0.08); }

.nav-list {
  display: flex;
  flex-direction: column;
  padding: 0 6px;
  gap: 2px;
}

/* Telegram Desktop Channel & DM Item Styling */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  color: #96a5b5;
  cursor: pointer;
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
  position: relative;
}

.nav-item:hover:not(.active) {
  background-color: #202b36;
  color: #ffffff;
}

.nav-item.active {
  background-color: #2b5278 !important;
  color: #ffffff !important;
  font-weight: 600;
}

.nav-item.active::before {
  display: none !important;
  content: none !important;
}

.channel-prefix {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-item.active .channel-prefix,
.nav-item:hover .channel-prefix {
  color: #ffffff;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  position: relative;
}

.room-avatar {
  background: var(--accent-primary);
  border-radius: 8px;
}

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

.dm-avatar .status-dot {
  bottom: -1px;
  right: -1px;
  border-color: var(--bg-darker);
}

.nav-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.nav-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}

.nav-preview {
  font-size: 0.75rem;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-unread {
  background-color: var(--status-dnd);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* User Footer Bar (Telegram Bottom Bar) */
.sidebar-user {
  height: 56px;
  background-color: #0e1621;
  border-top: 1px solid #242f3d;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-avatar-wrap {
  position: relative;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-user-bar);
}

.status-online { background-color: var(--status-online); }
.status-away { background-color: var(--status-away); }
.status-dnd { background-color: var(--status-dnd); }
.status-offline { background-color: var(--status-offline); }

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

.sidebar-username {
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-usertag {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Center Main Panel (Discord Chat Canvas) */
.center-panel {
  flex: 1;
  background-color: var(--bg-darkest);
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  position: relative;
}

/* Top bar (Telegram Channel Header) */
.center-topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid #242f3d;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #17212b;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.topbar-room-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.topbar-room-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #242f3d;
  color: #5288c1;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.topbar-room-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-room-desc {
  font-size: 0.76rem;
  color: #7f91a4;
  border-left: none;
  padding-left: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-topbar-voice {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0.35rem 0.85rem !important;
  border-radius: 20px !important;
  background: #2b5278 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  outline: none !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
}

.btn-topbar-voice:hover {
  background: #366593 !important;
  box-shadow: 0 4px 10px rgba(43, 82, 120, 0.4) !important;
}

.icon-btn {
  background: none;
  border: none;
  color: #7f91a4;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background-color: #202b36;
  color: #ffffff;
}
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn svg {
  pointer-events: none;
}

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

/* ── Telegram Desktop High-Fidelity Messages Canvas ───────────────── */
.messages-area {
  flex: 1;
  padding: 1.25rem 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: #0e1621;
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
  position: relative;
}

.message-item {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  width: 100%;
  margin-bottom: 0.35rem;
  position: relative;
}

.message-item.message-in {
  justify-content: flex-start;
}

.message-item.message-out {
  justify-content: flex-end;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  margin-bottom: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.message-bubble {
  max-width: 65%;
  min-width: 90px;
  padding: 0.55rem 0.85rem 0.45rem 0.85rem;
  border-radius: 12px;
  position: relative;
  word-break: break-word;
  font-size: 0.93rem;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.message-in .message-bubble {
  background-color: #182533 !important;
  border-bottom-left-radius: 3px !important;
  color: #f5f5f5;
}

.message-out .message-bubble {
  background-color: #2b5278 !important;
  border-bottom-right-radius: 3px !important;
  color: #ffffff;
}

.message-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6ab3f3;
  margin-bottom: 0.2rem;
  cursor: pointer;
}

.message-author:hover {
  text-decoration: underline;
}

.message-body {
  display: inline-block;
  width: 100%;
  position: relative;
}

.message-text {
  font-size: 0.93rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-left: 0.65rem;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  line-height: 1;
  color: #7f91a4;
  user-select: none;
  vertical-align: bottom;
  position: relative;
  top: 2px;
}

.message-out .message-meta-inline {
  color: #a4c9ee;
}

.check-icon {
  stroke: currentColor;
}

.reactions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: #2b2d31;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.reaction-badge:hover, .reaction-badge.active {
  border-color: var(--accent-primary);
  background: rgba(88, 101, 242, 0.15);
  color: #ffffff;
}

/* Discord/Telegram Input Composer */
.composer-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #0e1621;
  border-top: 1px solid #242f3d;
  z-index: 10;
}

.composer {
  height: 56px; /* Match sidebar user bar */
  padding: 0 1rem;
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.composer-inner {
  background: #17212b;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  width: 100%;
  transition: border-color 0.15s;
}

.composer-inner:focus-within {
  border-color: rgba(255, 255, 255, 0.15);
}

.composer-disabled {
  opacity: 0.55;
  pointer-events: none;
  background-color: #0e1621 !important;
  cursor: not-allowed;
}

.composer-disabled .composer-input[contenteditable="false"]::before {
  content: attr(data-placeholder) !important;
  color: #7f91a4 !important;
  font-style: italic !important;
}

.composer-btn {
  background: none;
  border: none;
  color: #b5bac1;
  padding: 0.4rem;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

.composer-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.composer-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.composer-input {
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  outline: none;
  font-size: 0.93rem;
  line-height: 1.4;
  color: #dbdee1;
  padding: 0.4rem 0.5rem;
}

.composer-send {
  color: #ffffff;
  background: var(--accent-primary);
  border-radius: 6px;
}

.composer-send:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.composer-input[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-dark);
  cursor: text;
}

/* Right Sidebar (Members Panel) */
.sidebar-right {
  width: var(--right-sidebar-width);
  background-color: var(--bg-darker);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-right-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 1rem 0.85rem 0.4rem;
}

.members-group {
  margin-bottom: 0.5rem;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem;
  margin: 1px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
}

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

.member-avatar-wrap {
  position: relative;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.member-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: #949ba4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-item:hover .member-name {
  color: #ffffff;
}

.member-role-badge {
  font-size: 0.62rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: #1e1f22;
  color: var(--text-muted);
  margin-left: auto;
}

/* Modals & Dialogs (Telegram High-Fidelity Aesthetic) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal {
  background: #17212b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  width: 480px;
  max-width: 92vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-wide {
  width: 580px;
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem 1.5rem;
  background: #17212b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #242f3d;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.modal-close {
  background: transparent;
  border: none;
  color: #7f91a4;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: #202b36;
  color: #ffffff;
}

/* Modal Tabs Navigation */
.modal-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  background: #0e1621;
  border-bottom: 1px solid #242f3d;
  overflow-x: auto;
}

.modal-tab {
  background: transparent;
  border: none;
  outline: none;
  color: #7f91a4;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.modal-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.modal-tab.active {
  background: #2b5278 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
  color: #dbdee1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #0e1621;
  border-top: 1px solid #242f3d;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* Form Controls in Modals */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #7f91a4;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #242f3d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #5288c1;
  box-shadow: 0 0 0 3px rgba(82, 136, 193, 0.2);
}

.btn-primary {
  background: #2b5278;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.55rem 1.35rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background: #366593;
  box-shadow: 0 4px 12px rgba(43, 82, 120, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #7f91a4;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* ── Mobile Responsive (Telegram Mobile Theme) ─────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 85vw;
    --right-sidebar-width: 85vw;
    --topbar-height: 52px;
  }

  .center-topbar {
    padding: 0 0.5rem !important;
    gap: 0.4rem !important;
    background-color: #17212b !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .topbar-room-info {
    flex: 1;
    min-width: 0;
    margin-left: 0.2rem;
  }

  .topbar-room-name {
    font-size: 0.95rem !important;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-room-desc {
    display: none !important;
  }

  /* Hide secondary topbar buttons on mobile so header stays clean */
  .topbar-actions .icon-btn[title="Search"],
  .topbar-actions .icon-btn[title="Pinned messages"] {
    display: none !important;
  }

  .btn-topbar-voice-text {
    display: none !important;
  }

  .btn-topbar-voice {
    padding: 0.4rem !important;
    border-radius: 50% !important;
    width: 34px !important;
    height: 34px !important;
    justify-content: center !important;
  }

  .messages-area {
    padding: 0.75rem 0.65rem 0.65rem 0.65rem !important;
    gap: 0.4rem !important;
    background-color: #0e1621 !important;
  }

  .message-item {
    display: flex !important;
    align-items: flex-end !important;
    gap: 0.5rem !important;
    width: 100% !important;
    margin-bottom: 0.35rem !important;
    position: relative !important;
  }

  .message-item.message-out {
    justify-content: flex-end !important;
    flex-direction: row !important;
  }

  .message-item.message-in {
    justify-content: flex-start !important;
    flex-direction: row !important;
  }

  /* Hide avatar on outgoing messages on mobile (Telegram Native Style) */
  .message-out .message-avatar {
    display: none !important;
  }

  .message-avatar {
    width: 32px !important;
    height: 32px !important;
    margin-bottom: 1px !important;
  }

  .message-bubble {
    max-width: 82% !important;
    min-width: 80px !important;
    padding: 0.5rem 0.75rem 0.4rem 0.75rem !important;
    font-size: 0.93rem !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }

  .message-out .message-bubble {
    background-color: #2b5278 !important;
    border-bottom-right-radius: 3px !important;
    color: #ffffff !important;
    margin-left: auto !important;
  }

  .message-in .message-bubble {
    background-color: #182533 !important;
    border-bottom-left-radius: 3px !important;
    color: #f5f5f5 !important;
    margin-right: auto !important;
  }

  .message-meta-inline {
    margin-left: 0.5rem !important;
    margin-top: 0.2rem !important;
    font-size: 0.68rem !important;
  }

  .message-text {
    font-size: 0.93rem !important;
    line-height: 1.35 !important;
  }

  .composer {
    padding: 0.45rem 0.6rem !important;
    background: #17212b !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 10 !important;
  }

  .composer-inner {
    gap: 0.4rem !important;
  }

  .composer-input-wrap {
    padding: 0 0.5rem !important;
    border-radius: 20px !important;
    background: #0e1621 !important;
  }

  .composer-input {
    font-size: 0.92rem !important;
    padding: 0.45rem 0.65rem !important;
  }

  .sidebar-left {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--sidebar-width);
    max-width: 300px;
    z-index: 100;
    transform: translateX(-100%);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar-left.mobile-open {
    transform: translateX(0);
  }

  .sidebar-right {
    position: fixed;
    top: 0; bottom: 0; right: 0;
    width: var(--right-sidebar-width);
    max-width: 280px;
    z-index: 100;
    transform: translateX(100%);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
    display: flex !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar-right.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.mobile-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-only {
    display: flex !important;
  }
}

/* Empty State */
.messages-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}
.messages-empty .empty-icon {
  opacity: 0.7;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}
.messages-empty h3 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin: 0;
  font-weight: 600;
}
.messages-empty p {
  font-size: 0.9rem;
  margin: 0;
  max-width: 250px;
}

/* Reply Preview in Bubble */
.message-reply-preview {
  display: flex;
  flex-direction: column;
  border-left: 3px solid var(--accent-primary);
  background: rgba(0,0,0,0.15);
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
}
.message-reply-preview .reply-author {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 3px;
}
.message-reply-preview .reply-text {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Reply Button */
.msg-action-reply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7f91a4;
  cursor: pointer;
  margin-right: 5px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  padding: 2px;
  border-radius: 4px;
}
.message-item:hover .msg-action-reply {
  opacity: 1;
}
.msg-action-reply:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
@media (max-width: 768px) {
  .msg-action-reply {
    opacity: 0.8;
  }
}

/* Emoji Picker Popup */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + 5px); /* Just above the composer */
  right: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 250px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}
.emoji-opt {
  font-size: 1.4rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.emoji-opt:hover {
  transform: scale(1.15);
  background: var(--bg-active);
}

/* Attachments */
.message-attachment-img {
  max-width: 100%;
  max-height: 350px;
  border-radius: 8px;
  margin-top: 5px;
  cursor: zoom-in;
  display: block;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.message-attachment-video {
  max-width: 100%;
  max-height: 350px;
  border-radius: 8px;
  margin-top: 5px;
  display: block;
  background: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Composer Reply Preview Container */
.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-dark);
  border-left: 3px solid var(--accent-primary);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.reply-preview span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.reply-preview strong {
  color: var(--accent-primary);
  font-weight: 600;
  margin-right: 4px;
}
.reply-preview em {
  font-style: normal;
  color: var(--text-main);
  opacity: 0.9;
}
.reply-preview button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0 0 12px;
  transition: color 0.2s, transform 0.1s;
}
.reply-preview button:hover {
  color: var(--status-dnd); /* Red cancel */
  transform: scale(1.15);
}

/* Reply block inside chat bubbles */
.message-reply-preview {
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--bg-hover);
  border-left: 3px solid var(--accent-primary);
  transition: opacity 0.2s;
}
.message-reply-preview:hover {
  opacity: 0.85;
}

.reply-author {
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.reply-text {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Specific styling for outgoing messages (blue bubble) */
.message-out .message-reply-preview {
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid rgba(255, 255, 255, 0.6);
}

.message-out .reply-author {
  color: #ffffff;
}

.message-out .reply-text {
  color: rgba(255, 255, 255, 0.85);
}
