/* ==========================================================================
   PTERONEXT PRIVACY MESSENGER - TITANIUM OBSIDIAN DESIGN SYSTEM
   Standard: WCAG AAA Contrast, 8px Grid, 48px Touch Targets, Fluid Transitions
   ========================================================================== */

:root {
  /* Surface Tokens */
  --bg-deep: #070B0E;
  --bg-obsidian: #0A0F14;
  --bg-elevated: #10171F;
  --bg-glass: #15202B;
  --bg-glass-high: #1C2B3A;
  --bg-card: #131D26;
  
  /* Borders */
  --border-subtle: #1E2E3E;
  --border-bright: #2C435A;
  --border-focus: #00E5A3;

  /* Typography Colors */
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-muted: #475569;

  /* Brand Accents */
  --emerald-primary: #00E5A3;
  --emerald-light: #25D366;
  --emerald-dark: #005C45;
  --emerald-glow: rgba(0, 229, 163, 0.22);
  --cyan-accent: #00E5FF;
  --cyan-glow: rgba(0, 229, 255, 0.22);
  --danger-coral: #FF5252;
  --warning-amber: #FFB300;

  /* Chat Bubbles */
  --bubble-out-start: #006B4E;
  --bubble-out-end: #004D37;
  --bubble-out-border: #00966C;
  --bubble-in-bg: #141F28;
  --bubble-in-border: #223342;

  /* Status Ticks */
  --ticks-read: #00E5FF;
  --ticks-delivered: #7E92A2;

  /* Geometry & Physics */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --transition-fast: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 280ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-luxury: 0 12px 36px -4px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.38);
}

/* ==========================================================================
   PWA INSTALL BANNER
   ========================================================================== */
.pwa-install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #101B24 0%, #15222E 100%);
  border-bottom: 1px solid var(--emerald-primary);
  box-shadow: 0 4px 20px rgba(0, 229, 163, 0.15);
  padding: 10px 16px;
  position: relative;
  z-index: 1000;
  animation: slideDown 300ms ease-out;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-icon-box .pwa-badge-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.pwa-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--emerald-primary);
}

.pwa-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.pwa-action-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

/* LEFT SIDEBAR */
.sidebar-panel {
  width: 400px;
  min-width: 340px;
  max-width: 460px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-obsidian);
  border-right: 1px solid var(--border-subtle);
  position: relative;
  z-index: 20;
}

/* RIGHT CHAT PANEL */
.chat-panel {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR HEADER & PROFILE
   ========================================================================== */
.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.user-profile-trigger:hover {
  background: rgba(255, 255, 255, 0.05);
}

.avatar-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E2E3E 0%, #2A3F55 100%);
  color: var(--emerald-primary);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-bright);
}

.presence-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-obsidian);
}

.presence-badge.online {
  background-color: var(--emerald-primary);
  box-shadow: 0 0 6px var(--emerald-primary);
}

.presence-badge.offline {
  display: none;
}

.status-label.offline {
  color: var(--text-tertiary);
}

.profile-info-header {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.profile-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--emerald-primary);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--emerald-primary);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 229, 163, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 5px rgba(0, 229, 163, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 229, 163, 0); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-chip-lang {
  background: var(--bg-glass);
  border: 1px solid var(--border-bright);
  color: var(--emerald-primary);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-chip-lang:hover {
  background: var(--emerald-primary);
  color: var(--bg-obsidian);
  border-color: var(--emerald-primary);
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald-primary) 0%, #00B37E 100%);
  color: #070B0E;
  box-shadow: 0 4px 14px var(--emerald-glow);
}

.btn-emerald:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(0, 229, 163, 0.35);
}

.btn-subtle {
  background: var(--bg-glass);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-subtle:hover {
  background: var(--bg-glass-high);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid var(--danger-coral);
  color: var(--danger-coral);
}

.btn-danger:hover {
  background: var(--danger-coral);
  color: #FFFFFF;
}

/* ==========================================================================
   SEARCH BAR & FILTERS
   ========================================================================== */
.search-section {
  padding: 12px 16px 8px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 42px;
  transition: border-color var(--transition-fast);
}

.search-input-wrapper:focus-within {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px var(--emerald-glow);
}

.search-icon {
  color: var(--text-tertiary);
  margin-right: 8px;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}

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

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.btn-clear:hover {
  color: var(--text-primary);
}

.filter-tabs {
  display: flex;
  gap: 6px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-tab {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.filter-tab.active {
  background: rgba(0, 229, 163, 0.12);
  border-color: var(--emerald-primary);
  color: var(--emerald-primary);
  font-weight: 600;
}

/* ==========================================================================
   CONVERSATIONS LIST
   ========================================================================== */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition-fast);
  position: relative;
}

.conv-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.conv-item.active {
  background-color: var(--bg-glass);
  border-left: 3px solid var(--emerald-primary);
}

.conv-avatar-box {
  position: relative;
  flex-shrink: 0;
}

.conv-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.conv-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  margin-left: 8px;
}

.conv-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.conv-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-pin, .icon-mute {
  font-size: 12px;
  color: var(--text-tertiary);
}

.unread-badge {
  background: var(--emerald-primary);
  color: #070B0E;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-footer {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
}

.e2ee-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ==========================================================================
   EMPTY CHAT STATE
   ========================================================================== */
.empty-chat-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: radial-gradient(circle at center, #0F1722 0%, var(--bg-deep) 70%);
}

.empty-illustration {
  margin-bottom: 24px;
}

.lock-shield-graphic {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(0, 229, 163, 0.08);
  border: 1px solid rgba(0, 229, 163, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(0, 229, 163, 0.15);
}

.empty-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.empty-desc {
  max-width: 500px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.empty-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================================
   ACTIVE CHAT AREA
   ========================================================================== */
.active-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.chat-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.chat-header-details {
  display: flex;
  flex-direction: column;
}

.chat-header-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.peer-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.lock-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 229, 163, 0.1);
}

.chat-subtitle {
  font-size: 12px;
  color: var(--emerald-primary);
  min-height: 16px;
}

.status-label {
  color: var(--text-tertiary);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--emerald-primary);
  font-weight: 500;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background: var(--emerald-primary);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* ==========================================================================
   MESSAGES STREAM CONTAINER
   ========================================================================== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--bg-deep);
  /* WhatsApp Dark subtle geometric tile */
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.date-divider {
  align-self: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin: 12px 0 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.message-row {
  display: flex;
  margin-bottom: 4px;
  position: relative;
  max-width: 82%;
  animation: fadeInMsg 180ms ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.incoming {
  align-self: flex-start;
}

.message-row.outgoing {
  align-self: flex-end;
}

.message-bubble {
  position: relative;
  padding: 8px 12px 6px 12px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.45;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.message-row.outgoing .message-bubble {
  background: linear-gradient(135deg, var(--bubble-out-start) 0%, var(--bubble-out-end) 100%);
  border: 1px solid var(--bubble-out-border);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.message-row.incoming .message-bubble {
  background-color: var(--bubble-in-bg);
  border: 1px solid var(--bubble-in-border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  float: right;
  margin-left: 10px;
}

.message-row.outgoing .message-meta {
  color: rgba(255, 255, 255, 0.7);
}

/* Status Ticks */
.tick-icon {
  display: inline-flex;
  align-items: center;
}

.tick-icon.delivered {
  color: var(--ticks-delivered);
}

.tick-icon.read {
  color: var(--ticks-read);
}

/* Audio Waveform Bubble */
.audio-bubble-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  padding: 4px 0;
}

.btn-audio-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-audio-play:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.3);
}

.audio-waveform-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  height: 28px;
}

.waveform-bar {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
  transition: height 150ms ease, background 150ms ease;
}

.waveform-bar.played {
  background: var(--cyan-accent);
}

.audio-time-label {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255, 255, 255, 0.8);
}

/* Photo Attachment Bubble */
.image-bubble-content img {
  max-width: 320px;
  max-height: 280px;
  border-radius: var(--radius-sm);
  display: block;
  cursor: pointer;
  margin-bottom: 4px;
}

/* ==========================================================================
   COMPOSER BAR & CONTROLS
   ========================================================================== */
.chat-composer {
  min-height: 64px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 10;
}

.input-container {
  flex: 1;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  transition: border-color var(--transition-fast);
}

.input-container:focus-within {
  border-color: var(--emerald-primary);
}

.message-input {
  width: 100%;
  max-height: 120px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.4;
  user-select: text;
  -webkit-user-select: text;
}

.message-input::placeholder {
  color: var(--text-tertiary);
}

.btn-action-send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--emerald-primary) 0%, #00B37E 100%);
  color: #070B0E;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--emerald-glow);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-bottom: 2px;
}

.btn-action-send:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(0, 229, 163, 0.4);
}

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

/* ==========================================================================
   ATTACHMENT & EMOJI TRAYS
   ========================================================================== */
.attachment-tray {
  position: absolute;
  bottom: 74px;
  left: 60px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow-luxury);
  animation: popIn 180ms ease-out;
  z-index: 50;
}

.attach-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 11px;
}

.attach-item:hover {
  color: var(--text-primary);
}

.attach-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  transition: transform var(--transition-fast);
}

.attach-circle:hover {
  transform: scale(1.1);
}

.attach-circle.color-purple { background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%); }
.attach-circle.color-blue   { background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%); }
.attach-circle.color-emerald{ background: linear-gradient(135deg, #00E5A3 0%, #059669 100%); }

.emoji-tray {
  position: absolute;
  bottom: 74px;
  left: 16px;
  width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-luxury);
  animation: popIn 180ms ease-out;
  z-index: 50;
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.emoji-tab {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.emoji-tab.active {
  background: var(--bg-glass);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.emoji-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  transition: transform var(--transition-fast);
}

.emoji-btn:hover {
  transform: scale(1.25);
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   RECORDING OVERLAY
   ========================================================================== */
.recording-overlay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  animation: slideUp 200ms ease-out;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger-coral);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--danger-coral);
  animation: pulseRed 1s infinite;
}

@keyframes pulseRed {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.recording-waveform-preview {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wave-bar {
  width: 3px;
  height: 14px;
  background: var(--emerald-primary);
  border-radius: 2px;
  animation: wavePulse 800ms infinite ease-in-out;
}

.wave-bar:nth-child(2) { height: 22px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 18px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 26px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes wavePulse {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.2); }
}

/* ==========================================================================
   DROPDOWN & MODALS
   ========================================================================== */
.menu-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-luxury);
  min-width: 200px;
  padding: 6px;
  z-index: 100;
  animation: popIn 160ms ease-out;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-item-danger {
  color: var(--danger-coral);
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 6px 0;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-luxury);
  padding: 24px;
  animation: zoomIn 220ms ease-out;
  position: relative;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* AUTH MODAL STYLING */
.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.brand-img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0, 229, 163, 0.25);
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-tagline {
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-lang-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
}

.auth-lang-btn {
  color: var(--text-tertiary);
  cursor: pointer;
  font-weight: 500;
}

.auth-lang-btn.active {
  color: var(--emerald-primary);
  font-weight: 700;
}

.auth-tab-row {
  display: flex;
  background: var(--bg-obsidian);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--bg-glass);
  color: var(--emerald-primary);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 44px;
  transition: border-color var(--transition-fast);
}

.form-input-wrapper:focus-within {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px var(--emerald-glow);
}

.input-icon {
  color: var(--text-tertiary);
  margin-right: 10px;
}

.form-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}

.form-check-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  gap: 8px;
}

.checkbox-container input {
  accent-color: var(--emerald-primary);
  width: 16px;
  height: 16px;
}

.quick-demo-section {
  margin-top: 18px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  text-align: center;
}

.quick-demo-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.quick-demo-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.chip-demo {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.chip-demo:hover {
  background: var(--bg-glass-high);
  color: var(--emerald-primary);
  border-color: var(--emerald-primary);
}

/* SETTINGS MODAL */
.settings-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E2E3E 0%, #2A3F55 100%);
  color: var(--emerald-primary);
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--emerald-primary);
}

.settings-username {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-user-id {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
  display: block;
}

.settings-status-badge {
  font-size: 11px;
  color: var(--emerald-primary);
  display: block;
  margin-top: 2px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.setting-subtitle {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.form-select {
  background: var(--bg-obsidian);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #2A3F55;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--emerald-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.settings-security-box {
  background: rgba(0, 229, 163, 0.06);
  border: 1px solid rgba(0, 229, 163, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 16px;
}

.sec-badge {
  font-weight: 700;
  font-size: 12px;
  color: var(--emerald-primary);
  margin-bottom: 4px;
}

.sec-text {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* QUICK CONTACTS */
.quick-contacts-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 12px 0 6px;
}

.quick-contact-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-contact-chip:hover {
  background: var(--bg-glass);
  border-color: var(--emerald-primary);
}

/* ALERTS & UTILS */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 12px;
}

.alert-danger {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid var(--danger-coral);
  color: #FFA4A4;
}

.alert-success {
  background: rgba(0, 229, 163, 0.15);
  border: 1px solid var(--emerald-primary);
  color: #A3FFDD;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE ADAPTIVE)
   ========================================================================== */
@media (max-width: 768px) {
  .mobile-only {
    display: flex;
  }

  .sidebar-panel {
    width: 100vw;
    max-width: 100vw;
    border-right: none;
  }

  .chat-panel {
    display: none;
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
  }

  .app-layout.show-chat .sidebar-panel {
    display: none;
  }

  .app-layout.show-chat .chat-panel {
    display: flex;
  }

  .messages-container {
    padding: 12px 14px;
  }

  .message-row {
    max-width: 90%;
  }

  .attachment-tray {
    left: 10px;
    right: 10px;
    justify-content: space-around;
  }

  .emoji-tray {
    width: calc(100vw - 32px);
  }
}
