/* ============================================
   UVLIS COMMUNITY — Design System
   A premium dark-mode community — Uvlis Universe
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');
@import url('/css/call.css?v=20260625-1');

/* === CSS Variables / Design Tokens === */
:root {
  /* Primary palette — electric violet + deep indigo */
  --primary-50: #f3f0ff;
  --primary-100: #e0d8ff;
  --primary-200: #c4b5fd;
  --primary-300: #a78bfa;
  --primary-400: #8b5cf6;
  --primary-500: #7c3aed;
  --primary-600: #6d28d9;
  --primary-700: #5b21b6;
  --primary-800: #4c1d95;
  --primary-900: #3b0764;

  /* Accent — electric cyan */
  --accent-400: #22d3ee;
  --accent-500: #06b6d4;
  --accent-600: #0891b2;

  /* Success / online */
  --success-400: #4ade80;
  --success-500: #22c55e;

  /* Danger / error */
  --danger-400: #f87171;
  --danger-500: #ef4444;

  /* Warning */
  --warning-400: #fbbf24;
  --warning-500: #f59e0b;

  /* Background layers */
  --bg-base: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a2e;
  --bg-overlay: #22223a;
  --bg-hover: #2a2a42;

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #9ca3b0;
  --text-muted: #5a5f72;
  --text-inverse: #0a0a0f;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Glass effect */
  --glass-bg: rgba(18, 18, 26, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #7c3aed, #06b6d4);
  --gradient-warm: linear-gradient(135deg, #e84393, #fd79a8);
  --gradient-hero: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #12121a 100%);
  --gradient-glow: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.15) 0%, transparent 70%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.3);
  --shadow-glow-accent: 0 0 30px rgba(6, 182, 212, 0.2);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.9375rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.5rem;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;
  --max-content-width: 1400px;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

body.sidebar-open {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

a {
  color: var(--primary-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-300);
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea {
  font-family: inherit;
  outline: none;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

/* ============================================
   LANDING PAGE / AUTH
   ============================================ */

.landing-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
  padding: var(--space-6);
}

/* Animated background orbs */
.landing-page::before,
.landing-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}

.landing-page::before {
  width: 500px;
  height: 500px;
  background: var(--primary-700);
  top: -10%;
  right: -5%;
  animation-delay: 0s;
}

.landing-page::after {
  width: 400px;
  height: 400px;
  background: var(--accent-600);
  bottom: -10%;
  left: -5%;
  animation-delay: -4s;
}

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

.auth-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  padding: var(--space-6);
  animation: slideUp 0.6s var(--transition-spring) forwards;
}

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

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo-icon {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
  font-size: 28px;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: var(--shadow-glow); }
  50% { box-shadow: 0 0 50px rgba(124, 58, 237, 0.5); }
}

.auth-logo h1 {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: #fff;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

/* Tab switcher */
.auth-tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  text-align: center;
}

.auth-tab.active {
  background: var(--primary-600);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Form styles */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
}

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

.form-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input:hover:not(:focus) {
  border-color: var(--border-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  padding: var(--space-4);
  background: var(--gradient-primary);
  color: white;
  font-size: var(--font-size-base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

/* Auth error/success messages */
.auth-message {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
  display: none;
  animation: fadeIn 0.3s ease;
}

.auth-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger-400);
}

.auth-message.success {
  display: block;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success-400);
}

/* ============================================
   CHAT PAGE LAYOUT
   ============================================ */

.chat-page {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg-base);
  width: 100%;
  position: relative;
}

/* Two decorative layers behind the (translucent) chat content:
   ::before = atmospheric gradient, ::after = animated detail. */
.chat-page::before,
.chat-page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.chat-page[data-room-theme]::before,
.chat-page[data-room-theme]::after { opacity: 1; }

/* ── Cyberpunk: neon depth + scrolling grid ── */
.chat-page[data-room-theme="theme_cyber"]::before {
  background:
    linear-gradient(180deg, rgba(7, 6, 22, 0.14), rgba(7, 6, 22, 0.64)),
    radial-gradient(120% 85% at 12% 6%, rgba(255, 0, 153, 0.24), transparent 44%),
    radial-gradient(120% 85% at 90% 12%, rgba(0, 238, 255, 0.24), transparent 42%),
    url("/assets/themes/cyberuvlis.png") center/cover no-repeat,
    linear-gradient(160deg, #09071a 0%, #120b2f 48%, #1a0d2b 100%);
}
.chat-page[data-room-theme="theme_cyber"]::after {
  background-image:
    linear-gradient(rgba(0, 238, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 153, 0.09) 1px, transparent 1px),
    radial-gradient(circle at 20% 18%, rgba(255, 59, 167, 0.22), transparent 0 18%),
    radial-gradient(circle at 82% 16%, rgba(34, 232, 255, 0.2), transparent 0 16%);
  background-size: 52px 52px, 52px 52px, auto, auto;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 84%, transparent);
  animation: rtCyberGrid 20s linear infinite, rtCyberPulse 7s ease-in-out infinite;
}
@keyframes rtCyberGrid {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 460px, 460px 0; }
}
@keyframes rtCyberPulse {
  0%, 100% { opacity: 0.64; }
  50%      { opacity: 0.94; }
}

/* ── Sunset: warm sky + pulsing sun ── */
.chat-page[data-room-theme="theme_sunset"]::before {
  background:
    radial-gradient(95% 65% at 50% 122%, rgba(255, 159, 67, 0.34), transparent 60%),
    linear-gradient(180deg, #2a1740 0%, #5f2a50 42%, #a8443f 76%, #e0763b 100%);
}
.chat-page[data-room-theme="theme_sunset"]::after {
  background:
    radial-gradient(closest-side at 50% 98%, rgba(255, 214, 140, 0.6), rgba(255, 150, 80, 0.2) 46%, transparent 72%);
  animation: rtSunGlow 9s ease-in-out infinite;
}
@keyframes rtSunGlow {
  0%, 100% { opacity: 0.8; transform: translateY(4px) scale(1); }
  50%      { opacity: 1;   transform: translateY(-6px) scale(1.04); }
}

/* ── Galaxy: nebula + twinkling starfield ── */
.chat-page[data-room-theme="theme_galaxy"]::before {
  background:
    radial-gradient(90% 70% at 18% 10%, rgba(138, 92, 246, 0.32), transparent 46%),
    radial-gradient(80% 60% at 84% 20%, rgba(67, 186, 255, 0.22), transparent 44%),
    radial-gradient(70% 55% at 60% 92%, rgba(236, 72, 153, 0.18), transparent 52%),
    linear-gradient(160deg, #05061a 0%, #0b1030 52%, #160a38 100%);
}
.chat-page[data-room-theme="theme_galaxy"]::after {
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #ffffff, transparent),
    radial-gradient(1.2px 1.2px at 70% 18%, #cfe3ff, transparent),
    radial-gradient(1.6px 1.6px at 42% 72%, #ffffff, transparent),
    radial-gradient(1px 1px at 86% 58%, #ffffff, transparent),
    radial-gradient(1.3px 1.3px at 56% 44%, #e9d5ff, transparent),
    radial-gradient(1px 1px at 10% 82%, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 92% 86%, #cfe3ff, transparent),
    radial-gradient(1px 1px at 33% 12%, #ffffff, transparent);
  background-size: 240px 240px;
  background-repeat: repeat;
  animation: rtTwinkle 4.5s ease-in-out infinite;
}
@keyframes rtTwinkle {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-page::before,
  .chat-page::after { animation: none !important; }
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: transform var(--transition-base);
  z-index: 100;
}

.sidebar-header {
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-brand h2 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: #fff;
}

.sidebar-close {
  display: none;
}

/* Rooms section */
.sidebar-section {
  padding: var(--space-4) var(--space-3);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2);
  margin-bottom: var(--space-2);
}

.sidebar-section-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.btn-add-room {
  width: 24px;
  height: 24px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.btn-add-room:hover {
  background: var(--bg-hover);
  color: var(--primary-400);
}

.module-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-fast);
}

.module-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(108, 92, 231, 0.28);
}

.module-link.active {
  background: var(--primary-800);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--text-primary);
}

.module-link-icon {
  width: 24px;
  text-align: center;
  font-size: 16px;
}

.room-list {
  list-style: none;
}

.room-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

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

.room-item.active {
  background: var(--primary-800);
  color: var(--text-primary);
}

.room-item .room-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.room-item .room-name {
  flex: 1;
}

.room-item .room-badge {
  background: var(--primary-500);
  color: white;
  font-size: var(--font-size-xs);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* Online users section */
.sidebar-section.online-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--border-subtle);
}

.online-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}
.online-user:hover { background: var(--bg-hover); }

/* ── People search ── */
.people-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-2) 0 var(--space-3);
  transition: border-color var(--transition-fast);
}
.people-search:focus-within { border-color: var(--primary-500); }
.people-search-ic {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
  flex-shrink: 0;
}
.people-search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  padding: 9px 0;
  min-width: 0;
}
.people-search-input::placeholder { color: var(--text-muted); }
.people-search-clear {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  background: none; color: var(--text-muted);
  cursor: pointer;
}
.people-search-clear:hover { color: var(--text-primary); background: var(--bg-hover); }

.people-results {
  margin-top: var(--space-2);
  display: flex; flex-direction: column; gap: 2px;
  max-height: 280px; overflow-y: auto;
  animation: fadeIn .2s ease;
}
.people-empty { padding: var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--font-size-sm); }

.person-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.person-row:hover { background: var(--bg-hover); }
.person-main {
  display: flex; align-items: center; gap: var(--space-3);
  flex: 1; min-width: 0; color: var(--text-primary);
}
.person-avatar {
  position: relative;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: .8rem;
  overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-muted);
  border: 2px solid var(--bg-surface);
}
.person-dot.on { background: var(--success-500); }
.person-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.person-name {
  font-size: var(--font-size-sm); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person-handle { font-size: var(--font-size-xs); color: var(--text-muted); }

.person-action { display: flex; gap: 4px; flex-shrink: 0; }
.person-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--primary-600);
  color: #fff;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}
.person-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.person-btn:active { transform: scale(.92); }
.person-btn.ghost { background: var(--bg-overlay); color: var(--text-secondary); border: 1px solid var(--border-default); }
.person-btn.ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.person-btn.accept { background: var(--success-500); }
.person-btn:disabled { opacity: .7; cursor: default; transform: none; }
.p-ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.requests-badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--primary-600); color: #fff;
  font-size: .68rem; font-weight: 700;
  margin-left: 6px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: white;
  position: relative;
  flex-shrink: 0;
}

.user-avatar.small {
  width: 26px;
  height: 26px;
  font-size: var(--font-size-xs);
}

.user-avatar .online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: var(--success-400);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.online-user-name {
  font-weight: 500;
  color: var(--text-primary);
}

/* User profile bar at the bottom */
.sidebar-profile {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-elevated);
}

.sidebar-profile-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  padding: var(--space-1);
  margin: calc(var(--space-1) * -1);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.sidebar-profile-link:hover { background: var(--bg-hover); }

.sidebar-profile .user-avatar {
  width: 36px;
  height: 36px;
  overflow: hidden;
}
.sidebar-profile .user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

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

.sidebar-profile-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-status {
  font-size: var(--font-size-xs);
  color: var(--success-400);
}

.btn-logout {
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-400);
}

/* === Main Chat Area === */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
}

.chat-main::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.chat-page[data-room-theme="theme_cyber"] .chat-main::before {
  opacity: 1;
  background:
    linear-gradient(180deg, rgba(7, 6, 22, 0.08), rgba(7, 6, 22, 0.42)),
    radial-gradient(70% 55% at 84% 10%, rgba(34, 232, 255, 0.18), transparent 42%),
    radial-gradient(65% 50% at 12% 12%, rgba(255, 59, 167, 0.16), transparent 40%),
    url("/assets/themes/cyberuvlis.png") center bottom / cover no-repeat;
}

/* Chat header */
.chat-header {
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg-surface);
}

.mobile-menu-btn {
  display: flex;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.mobile-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Desktop sidebar collapsed */
.sidebar.desktop-collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
  transition: width 0.25s ease, min-width 0.25s ease, border-right 0.25s ease;
}
.sidebar {
  transition: width 0.25s ease, min-width 0.25s ease, transform var(--transition-base);
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-room {
  font-size: var(--font-size-lg);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.chat-room-theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Compact, icon-only theme switcher on every size (declutters the header).
   Only the room's creator ever sees it (the [hidden] rule below). */
.chat-room-theme-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-room-theme-btn .theme-btn-text { display: none; }
.chat-room-theme-btn .theme-btn-ic { display: inline; font-size: 18px; line-height: 1; }

/* Theme name badge removed from the header for a cleaner look (the palette
   button already signals the room is themed). */
.chat-room-theme-badge { display: none !important; }

/* .btn / inline-flex set a display value, which overrides the [hidden]
   attribute. Restore hiding so the button only shows for the room's creator
   and the badge only shows when a theme is active. */
.chat-room-theme-btn[hidden],
.chat-room-theme-badge[hidden] {
  display: none;
}

.chat-header-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-online {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: var(--bg-overlay, #22223a);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
  white-space: nowrap;
}

.chat-header-online .dot {
  width: 8px;
  height: 8px;
  background: var(--success-400);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
  flex-shrink: 0;
}
.chat-online-label { color: var(--text-muted); font-weight: 600; }

/* Clickable "en línea" pill + its dropdown of connected people */
button.chat-header-online { cursor: pointer; transition: background .15s ease, border-color .15s ease; }
button.chat-header-online:hover { background: var(--bg-elevated, #1a1a2e); border-color: rgba(255,255,255,0.22); }
button.chat-header-online[aria-expanded="true"] { border-color: var(--success-400); }

.online-pop {
  position: absolute;
  top: calc(var(--header-height, 64px) + 8px);
  right: 12px;
  z-index: 60;
  width: min(300px, calc(100% - 24px));
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  background: var(--bg-elevated, #1a1a2e);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.55));
  overflow: hidden;
  animation: vcPanelIn 0.16s ease both;
}
.online-pop[hidden] { display: none; }
.online-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
}
.online-pop-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary, #f0f0f5); }
.online-pop-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary, #9ca3b0);
  background: var(--bg-overlay, #22223a);
  border-radius: var(--radius-full, 9999px);
  padding: 1px 8px;
  min-width: 20px;
  text-align: center;
}
.online-pop-list { overflow-y: auto; padding: 0 8px 10px; }
.online-pop-empty { padding: 4px 8px 12px; font-size: 0.82rem; color: var(--text-secondary, #9ca3b0); }

/* Messages area */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-base);
  background-image: var(--gradient-glow);
  overscroll-behavior: contain;
  position: relative;
}

/* Per-theme accent colors reused across the UI chrome */
.chat-page[data-room-theme="theme_cyber"]  { --rt-accent: #ff2d9b; --rt-accent2: #19e3ff; }
.chat-page[data-room-theme="theme_sunset"] { --rt-accent: #ff8a3d; --rt-accent2: #ffd166; }
.chat-page[data-room-theme="theme_galaxy"] { --rt-accent: #a78bfa; --rt-accent2: #5ec8ff; }

.chat-page[data-room-theme="theme_cyber"] {
  --rt-panel: rgba(8, 10, 24, 0.76);
  --rt-panel-strong: rgba(7, 8, 18, 0.84);
  --rt-border: rgba(34, 232, 255, 0.28);
  --rt-shadow: rgba(0, 0, 0, 0.48);
}

.chat-page[data-room-theme] .chat-header {
  background: var(--rt-panel, rgba(12, 14, 30, 0.72));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--rt-accent) 42%, transparent);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--rt-accent2) 28%, transparent),
    0 10px 30px var(--rt-shadow, rgba(0, 0, 0, 0.35));
}

.chat-page[data-room-theme] .chat-messages {
  background: rgba(8, 10, 22, 0.26);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.chat-page[data-room-theme] .chat-input-container {
  background: var(--rt-panel, rgba(12, 14, 30, 0.72));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--rt-accent) 32%, transparent);
}

.chat-page[data-room-theme] .welcome-banner,
.chat-page[data-room-theme] .message-history-controls,
.chat-page[data-room-theme] .message-body {
  position: relative;
  z-index: 1;
}

/* Voice panel (dropdown) gets the themed glass background in themed rooms. */
.chat-page[data-room-theme] .vc-panel {
  background: var(--rt-panel, rgba(12, 14, 30, 0.72));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: color-mix(in srgb, var(--rt-accent) 32%, transparent);
}

/* Themed input focus glow */
.chat-page[data-room-theme] .chat-input-wrapper {
  border-color: color-mix(in srgb, var(--rt-accent) 34%, transparent);
}
.chat-page[data-room-theme] .chat-input-wrapper:focus-within {
  border-color: var(--rt-accent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--rt-accent) 20%, transparent),
    0 0 26px color-mix(in srgb, var(--rt-accent) 28%, transparent);
}

/* Themed send button */
.chat-page[data-room-theme] .send-btn {
  background: linear-gradient(135deg, var(--rt-accent), var(--rt-accent2));
  box-shadow: 0 0 18px color-mix(in srgb, var(--rt-accent) 48%, transparent);
}
.chat-page[data-room-theme] .send-btn:hover {
  filter: brightness(1.08);
}

/* Themed header badge */
.chat-page[data-room-theme] .chat-room-theme-badge {
  background: color-mix(in srgb, var(--rt-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--rt-accent) 42%, transparent);
  color: #fff;
  box-shadow: 0 0 16px color-mix(in srgb, var(--rt-accent) 30%, transparent);
}

/* Themed sidebar room badge */
.chat-page[data-room-theme] .room-item .room-badge {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--rt-accent) 60%, transparent));
}

/* Themed welcome banner */
.chat-page[data-room-theme] .welcome-banner {
  border-color: color-mix(in srgb, var(--rt-accent) 30%, transparent);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.4),
    inset 0 0 70px color-mix(in srgb, var(--rt-accent) 9%, transparent);
}
.chat-page[data-room-theme] .welcome-banner h2 {
  background: linear-gradient(120deg, var(--rt-accent2), var(--rt-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-page[data-room-theme="theme_cyber"] .sidebar,
.chat-page[data-room-theme="theme_cyber"] .sidebar-profile,
.chat-page[data-room-theme="theme_cyber"] .chat-header,
.chat-page[data-room-theme="theme_cyber"] .chat-input-container {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--rt-panel-strong);
}

.chat-page[data-room-theme="theme_cyber"] .sidebar {
  border-right-color: rgba(34, 232, 255, 0.16);
  box-shadow:
    inset -1px 0 0 rgba(255, 59, 167, 0.16),
    18px 0 38px rgba(0, 0, 0, 0.24);
}

.chat-page[data-room-theme="theme_cyber"] .sidebar-header,
.chat-page[data-room-theme="theme_cyber"] .sidebar-section.online-section,
.chat-page[data-room-theme="theme_cyber"] .sidebar-profile {
  border-color: rgba(34, 232, 255, 0.12);
}

.chat-page[data-room-theme="theme_cyber"] .chat-header {
  position: relative;
  overflow: hidden;
}

.chat-page[data-room-theme="theme_cyber"] .chat-header::after {
  content: '';
  position: absolute;
  inset: auto -12% -1px auto;
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 232, 255, 0.9), rgba(255, 59, 167, 0.9), transparent);
  box-shadow: 0 0 24px rgba(34, 232, 255, 0.55);
}

.chat-page[data-room-theme="theme_cyber"] .chat-messages {
  background: linear-gradient(180deg, rgba(8, 10, 22, 0.18), rgba(8, 10, 22, 0.42));
}

.chat-page[data-room-theme="theme_cyber"] .welcome-banner {
  background:
    linear-gradient(135deg, rgba(6, 11, 28, 0.92), rgba(20, 10, 45, 0.78)),
    radial-gradient(circle at top right, rgba(34, 232, 255, 0.16), transparent 34%);
  border: 1px solid rgba(34, 232, 255, 0.24);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 59, 167, 0.16),
    inset 0 0 80px rgba(255, 59, 167, 0.08),
    0 0 34px rgba(34, 232, 255, 0.12);
}

.chat-page[data-room-theme="theme_cyber"] .welcome-banner p,
.chat-page[data-room-theme="theme_cyber"] .chat-header-desc,
.chat-page[data-room-theme="theme_cyber"] .chat-header-online {
  color: rgba(223, 234, 255, 0.82);
}

.chat-page[data-room-theme="theme_cyber"] .chat-room-theme-badge,
.chat-page[data-room-theme="theme_cyber"] .chat-room-theme-btn {
  background:
    linear-gradient(135deg, rgba(255, 59, 167, 0.18), rgba(34, 232, 255, 0.14));
  border-color: rgba(34, 232, 255, 0.3);
  color: #f8fbff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 59, 167, 0.16),
    0 0 18px rgba(34, 232, 255, 0.16);
}

.chat-page[data-room-theme="theme_cyber"] .room-item,
.chat-page[data-room-theme="theme_cyber"] .online-user,
.chat-page[data-room-theme="theme_cyber"] .module-link {
  border: 1px solid transparent;
}

.chat-page[data-room-theme="theme_cyber"] .room-item:hover,
.chat-page[data-room-theme="theme_cyber"] .room-item.active,
.chat-page[data-room-theme="theme_cyber"] .online-user:hover,
.chat-page[data-room-theme="theme_cyber"] .module-link:hover,
.chat-page[data-room-theme="theme_cyber"] .module-link.active {
  background: linear-gradient(135deg, rgba(255, 59, 167, 0.12), rgba(34, 232, 255, 0.08));
  border-color: rgba(34, 232, 255, 0.18);
  box-shadow: inset 0 0 24px rgba(34, 232, 255, 0.05);
}

/* Themed rooms keep the WhatsApp bubble shape — only the bubble itself is
   tinted, never the whole row (so there's no dark box around each message). */
.chat-page[data-room-theme="theme_cyber"] .message-body {
  background: rgba(10, 14, 32, 0.6);
  border: 1px solid rgba(34, 232, 255, 0.14);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  text-shadow: 0 0 18px rgba(34, 232, 255, 0.04);
}
.chat-page[data-room-theme="theme_cyber"] .message.own .message-body {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.92), rgba(91, 33, 182, 0.88));
  border-color: rgba(168, 130, 255, 0.4);
}

.chat-page[data-room-theme="theme_cyber"] .message-actions {
  background: rgba(8, 10, 24, 0.92);
  border-color: rgba(34, 232, 255, 0.22);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.3),
    0 0 18px rgba(255, 59, 167, 0.08);
}

.chat-page[data-room-theme="theme_cyber"] .chat-input-wrapper {
  background: rgba(6, 11, 26, 0.84);
  border-color: rgba(34, 232, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 59, 167, 0.08);
}

.chat-page[data-room-theme="theme_cyber"] .chat-input,
.chat-page[data-room-theme="theme_cyber"] .chat-input::placeholder {
  color: rgba(236, 244, 255, 0.9);
}

.chat-page[data-room-theme="theme_cyber"] .chat-input::placeholder {
  color: rgba(194, 208, 255, 0.52);
}

.chat-page[data-room-theme="theme_cyber"] .emoji-btn,
.chat-page[data-room-theme="theme_cyber"] .person-btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(34, 232, 255, 0.14);
  color: #dff6ff;
}

.chat-page[data-room-theme="theme_cyber"] .emoji-btn:hover,
.chat-page[data-room-theme="theme_cyber"] .person-btn.ghost:hover {
  background: linear-gradient(135deg, rgba(255, 59, 167, 0.14), rgba(34, 232, 255, 0.14));
  border-color: rgba(34, 232, 255, 0.28);
  box-shadow: 0 0 18px rgba(34, 232, 255, 0.08);
}

.chat-page[data-room-theme="theme_cyber"] .send-btn {
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 24px rgba(255, 59, 167, 0.28),
    0 0 38px rgba(34, 232, 255, 0.18);
}

.chat-page[data-room-theme="theme_cyber"] .chat-header-online .dot,
.chat-page[data-room-theme="theme_cyber"] .user-avatar .online-dot,
.chat-page[data-room-theme="theme_cyber"] .person-dot.on {
  background: #22e8ff;
  box-shadow:
    0 0 0 3px rgba(34, 232, 255, 0.08),
    0 0 14px rgba(34, 232, 255, 0.72);
}

/* Message bubbles */
/* ===== WhatsApp-style message bubbles ===== */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0;
  margin-top: 2px;
  animation: messageIn 0.22s var(--transition-spring) forwards;
  position: relative;
  max-width: 100%;
}

/* First bubble of a group gets extra breathing room above */
.message:not(.grouped) { margin-top: 11px; }

/* Own messages sit on the right side of the thread */
.message.own { flex-direction: row-reverse; }

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

.message:hover { background: transparent; }

.message:hover .message-actions {
  opacity: 1;
  visibility: visible;
}

.message .user-avatar {
  margin: 0;
  flex-shrink: 0;
  align-self: flex-end;
}
/* No avatar on your own messages; keep the gap on grouped ones for alignment */
.message.own .user-avatar { display: none; }
.message.grouped .user-avatar { visibility: hidden; }

/* The bubble itself */
.message-body {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(76%, 560px);
  padding: 6px 10px 6px;
  border-radius: 12px;
  background: #1f2532;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}
/* Little corner "tail" on the first bubble of each group */
.message:not(.grouped):not(.own) .message-body { border-top-left-radius: 4px; }
.message:not(.grouped).own .message-body { border-top-right-radius: 4px; }

/* Your own bubbles use the brand purple */
.message.own .message-body {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
}
.message.own .message-content { color: #fff; }
.message.own .message-time { color: rgba(255, 255, 255, 0.72); }

/* Media bubbles (stickers / images / voice / video) shed the bubble chrome */
.message-body:has(.message-sticker) {
  background: transparent !important;
  box-shadow: none;
  padding: 0;
}
.message-body:has(.chat-img-grid) { padding: 4px; }

.message-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}
/* Your own name and repeated names within a group are redundant */
.message.own .message-header,
.message.grouped .message-header { display: none; }

.message-username {
  font-weight: 700;
  font-size: 0.8rem;
}

/* Equipped badge (premium store item) shown next to names */
.message-badge,
.online-user-badge {
  font-size: 0.85em;
  line-height: 1;
  margin-left: 2px;
  filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.5));
}
.online-user-badge { margin-left: 4px; flex-shrink: 0; }

.message-time {
  display: block;
  text-align: right;
  font-size: 0.64rem;
  color: var(--text-muted);
  line-height: 1;
  margin-top: 3px;
  user-select: none;
}

.message-content {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

/* Message actions (reactions) */
.message-actions {
  position: absolute;
  top: -12px;
  right: var(--space-4);
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 5;
}

.message-actions button {
  width: 28px;
  height: 28px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background var(--transition-fast);
}

.message-actions button:hover {
  background: var(--bg-hover);
}

/* Hover actions hug the bubble on the correct side */
.message:not(.own) .message-actions { left: 52px; right: auto; }
.message.own .message-actions { right: var(--space-4); left: auto; }

/* Reactions display */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reaction-badge:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.reaction-badge.active {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--primary-500);
}

.reaction-badge .reaction-count {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== Replies (WhatsApp-style) ===== */

/* Reply button inside the hover actions menu */
.msg-reply-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.msg-reply-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Quoted message shown above a reply's content */
.message-quote {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: fit-content;
  max-width: 100%;
  text-align: left;
  margin-bottom: var(--space-1);
  padding: 4px 10px;
  border-left: 3px solid var(--primary-500, #7c3aed);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.10);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.message-quote:hover {
  background: rgba(124, 58, 237, 0.18);
}
/* Inside your own (purple) bubble the quote needs a lighter backdrop */
.message.own .message-quote {
  background: rgba(255, 255, 255, 0.16);
  border-left-color: rgba(255, 255, 255, 0.85);
}
.message.own .message-quote:hover { background: rgba(255, 255, 255, 0.24); }
.message.own .message-quote-name { color: #fff; }
.message.own .message-quote-text { color: rgba(255, 255, 255, 0.85); }
.message-quote-name {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--primary-400, #a78bfa);
}
.message-quote-text {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* Swipe-to-reply feedback (touch) */
.message.swiping {
  transition: none;
}
.message:not(.swiping) {
  transition: transform 0.18s var(--transition-spring);
}
.message.swipe-armed {
  background: rgba(124, 58, 237, 0.06);
  border-radius: var(--radius-md);
}

/* Flash highlight when jumping to a quoted message */
@keyframes messageFlash {
  0%   { background: rgba(124, 58, 237, 0.28); }
  100% { background: transparent; }
}
.message-flash {
  animation: messageFlash 1.4s ease-out;
  border-radius: var(--radius-md);
}

/* Reply preview bar above the composer */
.reply-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  animation: messageIn 0.2s ease forwards;
}
.reply-bar[hidden] { display: none; }
.reply-bar-stripe {
  width: 3px;
  align-self: stretch;
  border-radius: var(--radius-full);
  background: var(--primary-500, #7c3aed);
  flex-shrink: 0;
}
.reply-bar-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.reply-bar-name {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--primary-400, #a78bfa);
}
.reply-bar-snippet {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.reply-bar-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* System messages */
.message-system {
  text-align: center;
  padding: var(--space-2) 0;
}

.message-system span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
}

/* Typing indicator */
.typing-indicator {
  padding: var(--space-2) var(--space-6);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 24px;
}

.typing-indicator.active {
  display: flex;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* === Message Input === */
.chat-input-container {
  padding: var(--space-3) var(--space-6) var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg-surface) 22%);
  border-top: 1px solid var(--border-subtle);
}

/* The composer "pill" — soft, elevated, with a glowing focus ring */
.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 26px;
  padding: 5px 6px 5px 18px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  position: relative;
  overflow: visible;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary-500);
  background: var(--bg-hover, var(--bg-elevated));
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18), 0 8px 22px rgba(124, 58, 237, 0.14);
}

.chat-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  resize: none;
  max-height: 140px;
  line-height: 1.5;
  min-height: 24px;
  width: 100%;
  padding: 9px 0;
}

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

/* Action buttons (emoji/stickers/image/video/voice) grouped together so they
   can move above the textarea on mobile. */
.chat-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  position: relative;
  overflow: visible;
}

.chat-picker-anchor {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.emoji-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.emoji-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.emoji-btn:active { transform: scale(0.88); }

.emoji-btn.active {
  background: color-mix(in srgb, var(--primary-600) 20%, transparent);
  color: var(--primary-300, #c4b5fd);
}

.emoji-btn svg { width: 21px; height: 21px; }

/* On touch devices the native keyboard already offers emojis, so the
   in-app emoji button is redundant. Hide its whole anchor (stickers and
   voice note stay). Uses pointer:coarse so it targets phones/tablets
   rather than a fixed width. */
@media (pointer: coarse) {
  .chat-picker-anchor:has(> #emoji-btn) { display: none; }
}

/* Circular gradient send button with a soft brand glow */
.send-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
  flex-shrink: 0;
  align-self: flex-end;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.send-btn svg { transform: translateX(1px); }

.send-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}

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

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 360;
  width: min(280px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  transform-origin: bottom right;
}

.emoji-picker.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.emoji-picker-grid button {
  width: 32px;
  height: 32px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background var(--transition-fast);
}

.emoji-picker-grid button:hover {
  background: var(--bg-hover);
}

/* Sticker Picker */
.sticker-picker {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: none;
  box-shadow: var(--shadow-lg);
  z-index: 360;
  width: min(320px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(58vh, 420px);
  overflow: hidden;
  transform-origin: bottom right;
}

.sticker-picker.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

/* Pack tabs — horizontal scrollable row of pack icon buttons */
.sticker-pack-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sticker-pack-tabs::-webkit-scrollbar { display: none; }

.sticker-pack-tab {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700;
  color: var(--text-secondary);
  transition: background .15s, border-color .15s, transform .1s;
  overflow: hidden;
  padding: 3px;
}
.sticker-pack-tab:hover { background: var(--bg-hover); transform: scale(1.05); }
.sticker-pack-tab.active {
  border-color: var(--primary-600);
  background: color-mix(in srgb, var(--primary-600) 12%, transparent);
}
.sticker-pack-tab img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }

.sticker-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  padding: var(--space-3);
  max-height: 240px;
  overflow-y: auto;
}

.sticker-item {
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: var(--space-1);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-item:hover {
  background: var(--bg-hover);
  border-color: var(--primary-600);
  transform: scale(1.08);
}

.sticker-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.sticker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: var(--space-6) 0;
}

/* Sticker in chat messages */
.message-sticker {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-top: var(--space-1);
  cursor: default;
  transition: transform 0.15s ease;
}

.message-sticker:hover {
  transform: scale(1.05);
}

/* === Chat image gallery (WhatsApp-style) === */
.chat-img-grid {
  display: grid;
  gap: 3px;
  margin-top: var(--space-1);
  width: min(320px, 80vw);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.chat-img-grid.count-1 { grid-template-columns: 1fr; }
.chat-img-grid.count-2 { grid-template-columns: 1fr 1fr; }
.chat-img-grid.count-3 {
  grid-template-columns: 1fr 1fr;
}
.chat-img-grid.count-3 .chat-img-tile:first-child {
  grid-column: 1 / -1;
}
.chat-img-grid.count-4 { grid-template-columns: 1fr 1fr; }

.chat-img-tile {
  position: relative;
  padding: 0;
  border: none;
  margin: 0;
  cursor: pointer;
  background: var(--bg-surface);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  display: block;
}
/* A single image keeps a natural-ish aspect, not a hard square */
.chat-img-grid.count-1 .chat-img-tile {
  aspect-ratio: auto;
  max-height: 340px;
}
.chat-img-grid.count-3 .chat-img-tile:first-child {
  aspect-ratio: 2 / 1;
}

.chat-img-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}
.chat-img-grid.count-1 .chat-img-tile img {
  object-fit: contain;
  background: #000;
}
.chat-img-tile:hover img { transform: scale(1.04); }

.chat-img-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* === Lightbox === */
body.lightbox-open { overflow: hidden; }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
  touch-action: manipulation;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6);
  animation: lightboxIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pan-y pinch-zoom;
}

@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.lightbox-mobile-nav {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
}

.lightbox-mobile-btn {
  min-width: 110px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 600px) {
  .lightbox-nav { display: none; }
  .lightbox-counter { bottom: 76px; }
  .lightbox-mobile-nav { display: flex; }
  .lightbox-mobile-btn { min-width: 104px; }
  .chat-img-grid { width: min(280px, 78vw); }
}

/* ============================================
   VOICE & VIDEO NOTES
   ============================================ */

/* ── Voice note bubble ── */
.voice-msg {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  padding: 8px 14px 8px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  max-width: 300px;
  width: 100%;
}

/* Invitación a un Floor (mensaje DM tipo tarjeta) */
.floor-invite-card {
  display: flex; align-items: center; gap: 12px;
  margin-top: var(--space-1); padding: 10px 12px; max-width: 320px;
  text-decoration: none; color: inherit;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(34, 211, 238, 0.1));
  border: 1px solid rgba(124, 92, 255, 0.4); border-radius: 16px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.floor-invite-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(124, 92, 255, 0.3); }
.floor-invite-emoji { font-size: 30px; line-height: 1; flex: none; }
.floor-invite-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.floor-invite-label {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: #a78bfa; opacity: 0.9;
}
.floor-invite-name {
  font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.floor-invite-go {
  flex: none; padding: 7px 14px; border-radius: 999px;
  background: #7c5cff; color: #fff; font-size: 0.82rem; font-weight: 700;
}

.voice-play {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--primary-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.voice-play:hover { background: var(--primary-400); transform: scale(1.05); }
.voice-play:active { transform: scale(0.95); }

.voice-wave {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  overflow: hidden;
}

.voice-wave > span {
  flex: 1;
  min-width: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  opacity: 0.5;
}

.voice-wave-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(124, 58, 237, 0.28);
  border-radius: 4px;
  pointer-events: none;
  transition: width 0.1s linear;
}

.voice-time {
  flex-shrink: 0;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* ── Video note bubble (circular, WhatsApp style) ── */
.video-note {
  position: relative;
  width: 200px;
  height: 200px;
  max-width: 60vw;
  max-height: 60vw;
  margin-top: var(--space-1);
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--border-default);
  cursor: pointer;
}

.video-note-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-note-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.25);
  transition: opacity var(--transition-fast);
}

.video-note-overlay svg {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.video-note.playing .video-note-overlay { background: transparent; }

.video-note-time {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--font-size-xs);
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ── Voice recording bar (in the composer) ── */
.voice-record-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

.voice-record-bar[hidden] { display: none; }

.vr-cancel, .vr-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.vr-cancel { background: transparent; color: var(--text-muted); }
.vr-cancel:hover { background: var(--bg-hover); color: var(--danger-400, #f87171); }

.vr-send { background: var(--primary-500); color: #fff; }
.vr-send:hover { background: var(--primary-400); transform: scale(1.05); }

.vr-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: vrPulse 1s ease-in-out infinite;
}

@keyframes vrPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.vr-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 40px;
}

.vr-hint {
  flex: 1;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ── Video note recording modal ── */
.videonote-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.videonote-overlay[hidden] { display: none; }

.videonote-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  max-width: 92vw;
  animation: modalPop 0.2s ease both;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.videonote-modal h3 {
  margin: 0 0 var(--space-4);
  font-size: 1.05rem;
  color: var(--text-primary);
}

.videonote-circle {
  position: relative;
  width: 280px;
  height: 280px;
  max-width: 78vw;
  max-height: 78vw;
  margin: 0 auto var(--space-5);
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  border: 3px solid var(--primary-500);
}

.videonote-circle video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror like a selfie cam */
}

.vn-rec-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
}

.vn-rec-badge[hidden] { display: none; }

.videonote-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  align-items: center;
}

.vn-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.vn-btn[hidden] { display: none; }

.vn-close { background: var(--bg-hover); color: var(--text-secondary); }
.vn-close:hover { background: var(--bg-surface); color: var(--text-primary); }

.vn-record { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-default); }
.vn-record:hover { border-color: var(--primary-500); }

.vn-rec-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
}

.vn-record.recording .vn-stop-square,
.vn-stop-square {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: #ef4444;
  animation: vrPulse 1s ease-in-out infinite;
}

.vn-send { background: var(--primary-500); color: #fff; }
.vn-send:hover { background: var(--primary-400); transform: scale(1.03); }

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-4);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 440px;
  animation: modalIn 0.3s var(--transition-spring) forwards;
  box-shadow: var(--shadow-lg);
}

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

.modal h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-5);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-6);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: toastIn 0.4s var(--transition-spring) forwards;
  max-width: 360px;
  pointer-events: auto;
}

.toast.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

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

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

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
}

/* Date separator */
.date-separator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.date-separator span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Welcome message */
.message-history-controls {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.message-history-btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.message-history-btn:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.4);
  color: var(--text-primary);
}

.message-history-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.welcome-banner {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  margin-bottom: var(--space-4);
}

.welcome-banner h2 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  margin-bottom: var(--space-2);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-banner p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  max-width: 400px;
  margin: 0 auto;
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 60px;
  }

  body {
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    transform: translateX(-100%);
    will-change: transform;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    touch-action: pan-y;
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }

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

  .sidebar.open .sidebar-section.online-section {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .sidebar-profile {
    position: static;
  }

  /* Block interactions on content behind the open sidebar overlay */
  body.sidebar-open .chat-main,
  body.sidebar-open .tienda-content {
    pointer-events: none;
    user-select: none;
  }

  .sidebar-close {
    display: flex;
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  /* On mobile, desktop-collapsed has no effect — sidebar uses fixed overlay instead */
  .sidebar.desktop-collapsed {
    width: 85%;
    min-width: 0;
    max-width: 320px;
    overflow-y: auto;
    border-right: none;
    transform: translateX(-100%);
  }

  .sidebar.desktop-collapsed.open {
    transform: translateX(0);
  }

  .chat-header {
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }

  /* Keep the people-count visible on mobile, just more compact */
  .chat-header-online {
    height: 32px;
    padding: 0 9px;
    font-size: var(--font-size-xs);
  }
  .chat-online-label { display: none; }

  .vc-trigger {
    height: 32px;
    padding: 0 9px;
  }

  /* Theme switcher icon a touch smaller on mobile (badge + text already
     handled globally). The voice + people indicators stay. */
  .chat-room-theme-btn { width: 32px; min-width: 32px; height: 32px; }
  .chat-room-theme-btn .theme-btn-ic { font-size: 16px; }

  .chat-messages {
    padding: var(--space-3) var(--space-4);
  }

  .chat-input-container {
    padding: var(--space-3) var(--space-4);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  }

  .chat-input-wrapper {
    gap: var(--space-2);
    padding: 5px 6px 5px 14px;
    flex-wrap: wrap;
    align-items: center;
    border-radius: 24px;
  }
  /* Mobile: options row on top; textarea + send share the row below */
  .chat-actions {
    order: -1;
    width: 100%;
    justify-content: space-between;
    gap: 2px;
    padding: 2px 4px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .chat-input {
    order: 1;
    flex: 1 1 0;
    width: auto;       /* override base width:100% so send fits beside it */
    min-width: 0;
    padding: 7px 0;
  }
  .send-btn {
    order: 2;
    flex: 0 0 auto;
    align-self: center;
  }

  .form-input,
  .chat-input {
    font-size: 16px;
  }

  .auth-container {
    padding: var(--space-4);
    max-width: 100%;
  }

  .auth-card {
    padding: var(--space-6);
    border-radius: 20px;
  }

  .auth-logo h1 {
    font-size: var(--font-size-2xl);
  }

  .auth-logo {
    margin-bottom: var(--space-6);
  }

  .auth-tabs {
    margin-bottom: var(--space-5);
  }
}

@media (max-width: 480px) {
  .landing-page {
    padding: var(--space-4);
    align-items: stretch;
  }

  .auth-container {
    display: flex;
    align-items: center;
    min-height: 100%;
    padding: 0;
  }

  .auth-card {
    width: 100%;
    padding: 20px;
    border-radius: 18px;
  }

  .auth-tab {
    padding: 12px 10px;
  }

  .btn-primary {
    padding: 14px;
  }

  .message {
    gap: var(--space-2);
  }

  .message .user-avatar {
    width: 28px;
    height: 28px;
    font-size: var(--font-size-xs);
  }

  .chat-header-room {
    font-size: var(--font-size-base);
  }

  .chat-header-desc {
    max-width: 100%;
  }

  .chat-input-container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
x
  .chat-input-wrapper {
    border-radius: 42px;
    position: relative;
  }

  .emoji-btn {
    width: 38px;
    height: 38px;
  }
  .send-btn {
    width: 40px;
    height: 40px;
  }

  /* Let the picker escape the narrow button row and anchor to the full
     composer (.chat-input-wrapper is position:relative), so left/right:0
     stretches it edge-to-edge instead of to the ~2-button-wide actions bar. */
  .chat-picker-anchor,
  .chat-actions {
    position: static;
  }

  .emoji-picker,
  .sticker-picker {
    left: 0;
    right: 0;
    bottom: calc(100% + var(--space-2));
    width: auto;
    max-width: none;
    box-sizing: border-box;
    border-radius: 20px;
  }

  .emoji-picker {
    padding: var(--space-3);
  }

  .emoji-picker-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: min(40vh, 300px);
  }

  .sticker-picker {
    max-height: min(48vh, 360px);
  }

  .sticker-picker-grid {
    max-height: min(34vh, 280px);
  }

  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
  }

  .toast {
    max-width: 100%;
  }

  .welcome-banner {
    padding: var(--space-6) var(--space-3);
  }

  .welcome-banner h2 {
    font-size: 1.4rem;
  }
}

/* Utility classes */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* === Role choice modal (admin login) === */
.role-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease;
}
.role-overlay[hidden] { display: none; }

.role-modal {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(30, 30, 48, 0.9), rgba(16, 16, 26, 0.92));
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem 2rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: popIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Soft ambient glow at the top of the card */
.role-modal::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 65%);
  pointer-events: none;
}
.role-modal > * { position: relative; }

.role-modal-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-400);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

.role-modal-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  color: var(--primary-400);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px -8px rgba(139, 92, 246, 0.5);
}
.role-modal-icon svg { width: 32px; height: 32px; }

.role-modal h3 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.role-modal p { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.5; margin-bottom: 1.75rem; }

.role-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
@media (max-width: 460px) {
  .role-modal-actions { grid-template-columns: 1fr; }
}

/* Forced password-change form (inside role-modal) */
.force-pass-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-2);
}
.force-pass-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.force-pass-form .form-input { width: 100%; }
.force-pass-form .btn { width: 100%; margin-top: var(--space-2); }
.force-pass-form .auth-message:empty { display: none; }

.role-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 1.5rem 1rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
/* Sheen line that sweeps on hover */
.role-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.role-btn:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 16px 34px -14px rgba(139, 92, 246, 0.55);
}
.role-btn:hover::after { opacity: 1; }
.role-btn-admin:hover {
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(34, 211, 238, 0.06);
  box-shadow: 0 16px 34px -14px rgba(34, 211, 238, 0.5);
}

.role-btn-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.35rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-400);
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  transition: transform 0.2s ease;
}
.role-btn-admin .role-btn-icon {
  color: var(--accent-400);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.2);
}
.role-btn:hover .role-btn-icon { transform: scale(1.08); }
.role-btn-icon svg { width: 26px; height: 26px; }

.role-btn-title { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.role-btn-sub { font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; }

.role-btn-arrow {
  margin-top: 0.5rem;
  color: var(--text-muted);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.role-btn-arrow svg { width: 18px; height: 18px; display: block; }
.role-btn:hover .role-btn-arrow { opacity: 1; transform: translateX(0); color: var(--primary-400); }
.role-btn-admin:hover .role-btn-arrow { color: var(--accent-400); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

/* === Brand logo image + UVLIS wordmark (Poppins Bold) === */
.auth-logo-icon img,
.sidebar-brand-icon img,
.tienda-nav-brand-icon img,
.admin-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-logo h1,
.sidebar-brand h2,
.tienda-nav-brand h2,
.admin-brand h2 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* === Presence toasts (connect/disconnect) — small & fast === */
.toast-presence {
  padding: var(--space-2) var(--space-4);
  font-size: 0.78rem;
  opacity: 0.85;
  gap: var(--space-2);
}
.toast-presence .toast-icon { font-size: 10px; }

/* Close button on all toasts */
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 2px;
  margin-left: var(--space-1);
  line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); }

/* ============================================
   DIRECT MESSAGES (sidebar list + badges)
   ============================================ */
.dm-total-badge, .dm-item-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--gradient-primary, #7c3aed); color: #fff;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
}
.dm-total-badge { margin-left: 6px; }
.dm-list { list-style: none; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; }
.dm-empty { padding: 8px 12px; font-size: 0.8rem; color: var(--text-muted); }
.dm-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 12px; cursor: pointer; transition: background .15s ease;
}
.dm-item:hover { background: var(--bg-hover, rgba(255,255,255,0.05)); }
.dm-item.active { background: rgba(124,58,237,0.18); }
.dm-ava {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  font-weight: 700; color: #fff; font-size: 0.95rem;
}
.dm-ava img { width: 100%; height: 100%; object-fit: cover; }
.dm-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dm-item-name {
  font-size: 0.88rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.dm-item-last {
  font-size: 0.76rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm-item.unread .dm-item-name { color: #fff; }
.dm-item.unread .dm-item-last { color: var(--text-secondary); font-weight: 600; }
.dm-item-hint { opacity: .7; font-style: italic; }
.dm-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dm-dot.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dm-menu-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #ef4444; color: #fff;
  font-size: 0.65rem; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; line-height: 1;
  border: 2px solid var(--bg-surface, #15151f);
}

/* ============================================================
   CROSS-DOCUMENT VIEW TRANSITIONS
   Smooth, native-app-style navigation between pages (MPA).
   Opt-in on every page that loads styles.css. The browser
   cross-fades the outgoing/incoming document automatically;
   we refine it with a subtle fade + lift and keep the
   persistent sidebar anchored so it doesn't blink.
   Supported in Chrome/Edge/Safari TP; older browsers just
   navigate instantly (graceful fallback, no JS needed).
   ============================================================ */
@view-transition {
  navigation: auto;
}

/* Main content: gentle fade + vertical lift */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}
@keyframes uvlis-vt-out {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes uvlis-vt-in {
  from { opacity: 0; transform: translateY(8px); }
}
::view-transition-old(root) { animation-name: uvlis-vt-out; }
::view-transition-new(root) { animation-name: uvlis-vt-in; }

/* Keep the persistent left sidebar pinned across navigations
   so only the page content transitions (feels like a real app). */
.sidebar {
  view-transition-name: uvlis-sidebar;
}
/* The sidebar holds still — no cross-fade of its own snapshot. */
::view-transition-group(uvlis-sidebar) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Respect users who prefer less motion: instant, no animation. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
