/* ================================================================
   NEXCHAT — MODERN CHAT UI
   Design System: Dark-first, geometric, editorial
================================================================ */

/* ── RESET & ROOT ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }

/* ── DESIGN TOKENS ───────────────────────────────────────────── */
:root {
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
}

/* DARK THEME (default) */
[data-theme="dark"] {
  --bg-app:        #0d0e14;
  --bg-sidebar:    #111318;
  --bg-panel:      #15161e;
  --bg-input:      #1c1e28;
  --bg-hover:      #1e2030;
  --bg-active:     #252840;
  --bg-bubble-me:  #4f6ef7;
  --bg-bubble-them:#1e2030;
  --bg-header:     #111318ee;
  --bg-modal:      #1c1e28;
  --bg-tooltip:    #2a2d40;

  --accent:        #4f6ef7;
  --accent-light:  #7b96ff;
  --accent-glow:   rgba(79,110,247,.25);
  --online:        #3ddc97;
  --away:          #f5a623;
  --offline:       #666;
  --danger:        #ff5c5c;

  --text-primary:  #eef0f8;
  --text-secondary:#8891b2;
  --text-muted:    #505470;
  --text-bubble-me:#fff;

  --border:        rgba(255,255,255,.06);
  --border-strong: rgba(255,255,255,.12);

  --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
  --shadow-md:  0 8px 32px rgba(0,0,0,.5);
  --shadow-lg:  0 20px 60px rgba(0,0,0,.7);
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-app:        #f0f2f8;
  --bg-sidebar:    #ffffff;
  --bg-panel:      #f7f8fc;
  --bg-input:      #ffffff;
  --bg-hover:      #f0f2f8;
  --bg-active:     #e8ecff;
  --bg-bubble-me:  #4f6ef7;
  --bg-bubble-them:#ffffff;
  --bg-header:     #ffffffee;
  --bg-modal:      #ffffff;
  --bg-tooltip:    #2a2d40;

  --accent:        #4f6ef7;
  --accent-light:  #3355e0;
  --accent-glow:   rgba(79,110,247,.15);
  --online:        #22b870;
  --away:          #f5a623;
  --offline:       #bbb;
  --danger:        #e03c3c;

  --text-primary:  #14162a;
  --text-secondary:#5a6080;
  --text-muted:    #a0a8c0;
  --text-bubble-me:#fff;

  --border:        rgba(0,0,0,.07);
  --border-strong: rgba(0,0,0,.12);

  --shadow-sm:  0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 8px 32px rgba(0,0,0,.12);
  --shadow-lg:  0 20px 60px rgba(0,0,0,.18);
}

/* ── BASE ────────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
  transition: background .3s, color .3s;
}

/* ── APP SHELL ───────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .3s;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text-primary);
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.avatar-me {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* SEARCH */
.search-wrap {
  position: relative;
  margin: 14px 16px 10px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 40px 9px 38px;
  font-size: .875rem;
  color: var(--text-primary);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* TABS */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px 10px;
}
.tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.tab.active {
  background: var(--bg-active);
  color: var(--accent);
}
.tab:hover:not(.active) { background: var(--bg-hover); }
.tab-badge {
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 1px 5px;
}

/* CONVERSATION LIST */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
  scroll-behavior: smooth;
}
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-active); }

.conv-avatar {
  position: relative;
  flex-shrink: 0;
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-active);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.chat-avatar.large { width: 40px; height: 40px; font-size: 15px; }

/* Avatar color variants */
.chat-avatar[data-color="0"] { background: #1e2a4a; color: #4f6ef7; }
.chat-avatar[data-color="1"] { background: #1a3428; color: #3ddc97; }
.chat-avatar[data-color="2"] { background: #3d1a2e; color: #f06292; }
.chat-avatar[data-color="3"] { background: #3d2e1a; color: #ffb74d; }
.chat-avatar[data-color="4"] { background: #2e1a3d; color: #ce93d8; }
.chat-avatar[data-color="5"] { background: #1a3a3d; color: #4dd0e1; }

.status-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}
.status-badge.online  { background: var(--online); }
.status-badge.away    { background: var(--away); }
.status-badge.offline { background: var(--offline); }

.conv-info {
  flex: 1;
  min-width: 0;
}
.conv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.conv-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  font-size: .7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 6px;
}
.conv-preview {
  font-size: .78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.conv-preview.unread { color: var(--text-primary); font-weight: 500; }

.unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 2px 6px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* ── CHAT PANEL ──────────────────────────────────────────────── */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  position: relative;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.back-btn { display: none; }

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.chat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -.01em;
}
.chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 1px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--offline);
}
.status-dot.online { background: var(--online); }
.status-dot.away   { background: var(--away); }

/* MSG SEARCH BAR */
.msg-search-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.msg-search-bar.open { display: flex; }
.msg-search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: .875rem;
}
.msg-search-bar input::placeholder { color: var(--text-muted); }
.msg-search-results { font-size: .75rem; color: var(--text-muted); }
.msg-search-bar button { color: var(--text-muted); font-size: 14px; }

/* ── MESSAGES AREA ───────────────────────────────────────────── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  position: relative;
}
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

.messages-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  color: var(--border-strong);
  animation: pulse 3s ease-in-out infinite;
}
.empty-state p { font-size: .9rem; }

.load-more-trigger { height: 1px; }

/* ── DATE DIVIDER ────────────────────────────────────────────── */
.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  color: var(--text-muted);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.date-divider::before, .date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── MESSAGE ROW ─────────────────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: msgIn .25s var(--ease-out) both;
}
.msg-row.me { flex-direction: row-reverse; }
.msg-row + .msg-row { margin-top: 2px; }
.msg-row.group-start { margin-top: 14px; }
.msg-row.highlight .msg-bubble { outline: 2px solid var(--accent); }

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

.msg-avatar-wrap {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-active);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.msg-row.me .msg-avatar-wrap { display: none; }
.msg-row.no-avatar .msg-avatar { opacity: 0; }

.msg-content {
  max-width: 65%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-row.me .msg-content { align-items: flex-end; }

.msg-sender {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0 10px;
  font-family: var(--font-display);
}

.msg-bubble {
  background: var(--bg-bubble-them);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  font-size: .88rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  border: 1px solid var(--border);
  transition: background .2s;
}
.msg-row.me .msg-bubble {
  background: var(--bg-bubble-me);
  color: var(--text-bubble-me);
  border-radius: 16px 16px 4px 16px;
  border-color: transparent;
}
.msg-bubble.first-in-group    { border-radius: 16px 16px 16px 4px; }
.msg-bubble.last-in-group     { border-radius: 4px 16px 16px 4px; }
.msg-bubble.middle-in-group   { border-radius: 4px 16px 16px 4px; }
.msg-row.me .msg-bubble.first-in-group  { border-radius: 16px 16px 4px 16px; }
.msg-row.me .msg-bubble.last-in-group   { border-radius: 16px 4px 16px 16px; }
.msg-row.me .msg-bubble.middle-in-group { border-radius: 16px 4px 4px 16px; }

/* Image message */
.msg-image {
  border-radius: 12px;
  max-width: 260px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity .2s;
}
.msg-image:hover { opacity: .92; }

/* File message */
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-bubble-them);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.msg-row.me .msg-file {
  background: rgba(255,255,255,.15);
  border-color: transparent;
}
.msg-file-icon { font-size: 24px; }
.msg-file-name { font-size: .8rem; font-weight: 500; }
.msg-file-size { font-size: .7rem; color: var(--text-secondary); }

/* Meta row */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  font-size: .68rem;
  color: var(--text-muted);
}
.msg-row.me .msg-meta { justify-content: flex-end; }
.msg-time {}
.read-receipt { font-size: .7rem; }
.read-receipt.delivered { color: var(--text-muted); }
.read-receipt.seen      { color: var(--accent-light); }

/* ── TYPING INDICATOR ────────────────────────────────────────── */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 24px 0;
}
.typing-indicator.visible { display: flex; }
.typing-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--bg-active);
  color: var(--accent);
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  display: grid;
  place-items: center;
}
.typing-bubble {
  background: var(--bg-bubble-them);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-bubble span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.2s ease-in-out infinite;
}
.typing-bubble span:nth-child(2) { animation-delay: .2s; }
.typing-bubble span:nth-child(3) { animation-delay: .4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}
.typing-label { font-size: .72rem; color: var(--text-muted); }

/* ── INPUT AREA ──────────────────────────────────────────────── */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  position: relative;
  z-index: 5;
}

.input-wrap {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  transition: border-color .2s, box-shadow .2s;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  align-items: center;
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.message-input {
  flex: 1;
  outline: none;
  color: var(--text-primary);
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 22px;
}
.message-input:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.attach-btn { color: var(--text-secondary); font-size: 20px; }
.emoji-btn  { color: var(--text-secondary); font-size: 18px; }

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform .15s var(--ease-spring), box-shadow .2s;
  flex-shrink: 0;
}
.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.send-btn:active { transform: scale(.95); }

/* ── EMOJI PICKER ────────────────────────────────────────────── */
.emoji-picker {
  position: absolute;
  bottom: 72px;
  right: 66px;
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  width: 280px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 100;
  animation: fadeUp .2s var(--ease-out);
}
.emoji-picker.open { display: block; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.emoji-btn-item {
  font-size: 20px;
  padding: 6px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s, transform .12s;
  user-select: none;
}
.emoji-btn-item:hover {
  background: var(--bg-hover);
  transform: scale(1.2);
}

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

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  align-items: center;
}

.toast {
  background: var(--bg-tooltip);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 10px 18px 10px 14px;
  border-radius: var(--radius-md);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: toastIn .3s var(--ease-spring) both;
  pointer-events: all;
  min-width: 220px;
}
.toast.out { animation: toastOut .2s var(--ease-out) both; }
.toast-avatar {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--bg-active);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.toast-text { flex: 1; line-height: 1.35; }
.toast-sender { font-weight: 600; font-size: .8rem; }
.toast-msg { color: var(--text-secondary); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.9); } }

/* ── FILE PREVIEW MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  place-items: center;
  z-index: 9990;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { display: grid; }

.modal-box {
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 500px;
  width: calc(100% - 40px);
  box-shadow: var(--shadow-lg);
  animation: modalIn .3s var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 13px;
  display: grid;
  place-items: center;
}
.modal-close:hover { background: var(--danger); color: #fff; }

.modal-content img {
  width: 100%;
  border-radius: var(--radius-md);
  max-height: 360px;
  object-fit: contain;
}
.modal-file-info {
  padding: 20px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: .9rem;
}
.modal-file-icon { font-size: 48px; margin-bottom: 8px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 11px 24px;
  font-size: .88rem;
  font-weight: 600;
  font-family: var(--font-display);
  text-align: center;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: .3; }
  50%       { opacity: .7; }
}

/* ── SCROLLBAR GLOBAL ────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: absolute;
    inset: 0;
    z-index: 50;
    transform: translateX(0);
    transition: transform .28s var(--ease-out);
  }
  .sidebar.hidden { transform: translateX(-100%); }
  .chat-panel {
    position: absolute;
    inset: 0;
    z-index: 40;
    transform: translateX(100%);
    transition: transform .28s var(--ease-out);
  }
  .chat-panel.active { transform: translateX(0); }
  .back-btn { display: grid; }
}

/* THEME TRANSITION */
*, *::before, *::after {
  transition-property: background-color, border-color, color;
  transition-duration: .25s;
  transition-timing-function: ease;
}
/* but don't transition transforms/positions */
.msg-row, .send-btn, .emoji-btn-item, .conv-item, .tab { transition-property: all; }
