/* ═══════════════════════════════════════════════════════════════
   SUB-AGENTE 1 — CSS VISUAL SYSTEM v2
   ChatBox Revolution v2 — Gaming 3D Experience
   Cargar DESPUÉS de chatbox_base.css
   ═══════════════════════════════════════════════════════════════ */

/* ─── Variables de diseño ─── */
:root {
  --cx-bg-panel: rgba(10, 10, 16, 0.97);
  --cx-bg-glass: rgba(20, 20, 32, 0.85);
  --cx-border-glow: rgba(212, 118, 60, 0.6);
  --cx-accent: #d4763c;
  --cx-accent-hot: #ff8c42;
  --cx-accent2: #3cd4a0;
  --cx-online: #00ff88;
  --cx-offline: #444455;
  --cx-neon-blue: #00d4ff;
  --cx-neon-purple: #8800ff;
  --cx-text-primary: #e8e4e0;
  --cx-text-muted: #8a8490;
  --cx-shadow-3d: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(212,118,60,0.15);
  --cx-font: 'Segoe UI', 'Inter', system-ui, sans-serif;
  --cx-radius: 16px;
  --cx-radius-msg: 18px 18px 4px 18px;
  --cx-radius-msg-in: 4px 18px 18px 18px;
}

/* ─── Panel principal ─── */
.cx-panel {
  position: fixed !important;
  bottom: 90px !important;
  right: 24px !important;
  width: 480px;
  max-width: calc(100vw - 48px);
  height: min(640px, calc(100vh - 120px));
  min-height: 320px;
  max-height: calc(100vh - 100px);
  background: var(--cx-bg-panel) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--cx-shadow-3d), 0 0 30px rgba(212,118,60,0.2) !important;
  transform-style: preserve-3d;
  border: 1px solid rgba(212,118,60,0.25) !important;
  border-radius: var(--cx-radius) !important;
  display: flex;
  flex-direction: row !important;
  will-change: transform, opacity;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease !important;
  overflow: hidden !important;
}
.cx-panel.cx-hiding {
  transform: translateY(100px) scale(0.92) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.cx-panel:not(.cx-hiding) {
  transform: translateY(0) scale(1) !important;
  opacity: 1 !important;
}

/* ─── Sidebar izquierda ─── */
.cx-sidebar-left {
  width: 40px;
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
  background: rgba(8,8,14,0.9);
  border-right: 1px solid rgba(212,118,60,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 4px;
  flex-shrink: 0;
}
.cx-sidebar-left.cx-sidebar-expanded {
  width: 160px;
}

.cx-sidebar-toggle {
  width: 32px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--cx-text-muted);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  transition: all 0.2s ease;
  padding: 0;
}
.cx-sidebar-toggle:hover {
  background: rgba(212,118,60,0.15);
  color: var(--cx-accent);
}

.cx-sidebar-sep {
  font-size: 9px;
  font-weight: 700;
  color: var(--cx-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 6px 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cx-sidebar-expanded .cx-sidebar-sep { opacity: 1; }

.cx-sidebar-sep-line {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 4px 0;
}

.cx-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-sidebar-footer {
  margin-top: auto;
  padding: 6px 2px;
  display: flex;
  justify-content: center;
}
.cx-sidebar-footer .cx-header-mute-btn {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

/* ─── Fila de usuario ─── */
.cx-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  will-change: transform, background;
  position: relative;
}
.cx-user-row:hover {
  background: rgba(212,118,60,0.12);
  transform: translateX(2px) scale(1.02);
}
.cx-user-row.cx-user-appearing {
  animation: cx-user-slide-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.cx-user-row.cx-user-disappearing {
  animation: cx-user-fade-out 0.4s ease forwards;
}

.cx-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--cx-user-color, #555);
  box-shadow: 0 0 0 2px var(--cx-bg-panel), 0 0 0 3px var(--cx-user-color);
  flex-shrink: 0;
  position: relative;
  will-change: transform;
  color: #fff;
}

.cx-user-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--cx-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.cx-user-badge.cx-show { display: flex; }

.cx-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}
.cx-sidebar-expanded .cx-user-info { opacity: 1; }

.cx-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--cx-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-user-role {
  font-size: 11px;
  color: var(--cx-text-muted);
}

.cx-user-buzz-btn {
  display: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255,200,0,0.15);
  border: 1px solid rgba(255,200,0,0.3);
  color: #ffc800;
  font-size: 12px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.cx-user-row:hover .cx-user-buzz-btn { display: flex; }
.cx-user-buzz-btn:hover {
  background: rgba(255,200,0,0.3);
  transform: scale(1.1);
}

/* Global WLM buzz button in header */
.cx-buzz-btn {
  position: absolute;
  top: 7px;
  right: 40px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,200,0,0.35);
  background: linear-gradient(135deg, rgba(255,180,0,0.18), rgba(255,100,0,0.12));
  color: #ffc800;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,220,80,0.15);
}
.cx-buzz-btn .cx-buzz-icon {
  display: block;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255,180,0,0.6));
  transition: filter 0.2s ease, transform 0.15s ease;
}
.cx-buzz-btn:hover {
  background: linear-gradient(135deg, rgba(255,180,0,0.32), rgba(255,100,0,0.22));
  border-color: rgba(255,200,0,0.7);
  box-shadow: 0 0 14px rgba(255,180,0,0.45), 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,220,80,0.2);
  transform: scale(1.1);
}
.cx-buzz-btn:hover .cx-buzz-icon {
  filter: drop-shadow(0 0 7px rgba(255,200,0,0.9));
  transform: scale(1.05);
}
.cx-buzz-btn:active {
  transform: scale(0.95);
  box-shadow: 0 0 8px rgba(255,180,0,0.6), inset 0 1px 4px rgba(0,0,0,0.3);
}
.cx-panel .cx-buzz-btn { display: flex; }

/* ─── Indicador online ─── */
.cx-online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cx-online);
  box-shadow: 0 0 6px var(--cx-online);
  animation: cx-pulse-online 2s ease-in-out infinite;
  flex-shrink: 0;
}
.cx-online-dot.cx-offline {
  background: var(--cx-offline);
  box-shadow: none;
  animation: none;
}

/* ─── Burbujas de mensaje ─── */
.cx-msg-out .cx-bubble {
  background: linear-gradient(135deg, #d4763c 0%, #c06028 100%) !important;
  border-radius: var(--cx-radius-msg) !important;
  box-shadow: 0 4px 16px rgba(212,118,60,0.35), 0 0 0 1px rgba(255,140,66,0.2) !important;
  transform-style: preserve-3d;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  will-change: transform;
  color: #fff;
}
.cx-msg-out .cx-bubble:hover {
  transform: perspective(400px) rotateX(-3deg) rotateY(3deg) translateY(-2px);
  box-shadow: 0 8px 24px rgba(212,118,60,0.5), 0 0 0 1px rgba(255,140,66,0.3) !important;
}

.cx-msg-in .cx-bubble {
  background: rgba(28,28,42,0.9) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: var(--cx-radius-msg-in) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
  transition: transform 0.15s ease;
  will-change: transform;
}
.cx-msg-in .cx-bubble:hover {
  transform: perspective(400px) rotateX(-3deg) rotateY(-3deg) translateY(-2px);
}

.cx-msg-ai .cx-bubble {
  background: linear-gradient(135deg, rgba(30,20,50,0.95) 0%, rgba(20,15,40,0.95) 100%) !important;
  border: 1px solid rgba(136,0,255,0.3) !important;
  box-shadow: 0 0 20px rgba(136,0,255,0.15), 0 4px 20px rgba(0,0,0,0.5) !important;
  border-radius: var(--cx-radius-msg-in) !important;
}

/* ─── Mensaje sistema ─── */
.cx-msg-system {
  text-align: center;
  padding: 8px 16px;
  margin: 8px auto;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.08), transparent);
  border-top: 1px solid rgba(0,212,255,0.15);
  border-bottom: 1px solid rgba(0,212,255,0.15);
  color: var(--cx-neon-blue);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  animation: cx-system-glow 3s ease-in-out infinite alternate;
  max-width: 90%;
}

/* ─── Sugerencias rápidas ─── */
.cx-msg-suggestions {
  justify-content: center;
  padding: 8px 12px;
  background: rgba(0,212,255,0.02);
  border-radius: 12px;
  border: 1px dashed rgba(0,212,255,0.1);
}

.cx-suggestion-chip {
  white-space: nowrap;
}
.cx-suggestion-chip:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(212,118,60,0.2) !important;
}

/* ─── Rich cards ─── */
.cx-msg-card {
  max-width: 320px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ─── Botones de acción en mensajes ─── */
.cx-msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cx-msg-action-btn {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--cx-text-primary);
  transition: all 0.15s ease;
}
.cx-msg-action-btn:hover {
  background: rgba(212,118,60,0.15);
  border-color: rgba(212,118,60,0.3);
}
.cx-msg-action-btn.cx-primary {
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-hot));
  border-color: transparent;
  color: #fff;
}

/* ─── Toggle compacto ─── */
.cx-toggle-compact {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.3);
  color: var(--cx-text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 10;
  transition: all 0.2s ease;
}
.cx-toggle-compact:hover {
  background: rgba(212,118,60,0.15);
  color: var(--cx-accent);
}
.cx-panel.cx-compact .cx-toggle-compact {
  display: flex;
}

/* ─── Estado compacto ─── */
.cx-panel.cx-compact {
  width: 360px !important;
  height: 420px !important;
}
.cx-panel.cx-compact .cx-sidebar-left {
  display: none;
}
.cx-panel.cx-compact .cx-mode-bar {
  display: none;
}
.cx-panel.cx-compact .cx-header-title-wrap {
  display: none;
}
.cx-panel.cx-compact .cx-voice-state {
  display: none;
}
.cx-panel.cx-compact .cx-header-status {
  display: none;
}

/* Responsive: mostrar toggle compacto en móviles */
@media (max-width: 520px) {
  .cx-toggle-compact {
    display: flex !important;
  }
}

/* ─── FAB Button ─── */
.cx-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4763c, #e8903a, #d4763c) !important;
  background-size: 200% 200% !important;
  animation: cx-fab-gradient 4s ease infinite !important;
  box-shadow: 0 4px 20px rgba(212,118,60,0.6), 0 0 0 0 rgba(212,118,60,0.4) !important;
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  will-change: transform, box-shadow;
  cursor: pointer;
  border: none;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
}
.cx-fab:hover {
  transform: scale(1.12) translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,118,60,0.8), 0 0 40px rgba(212,118,60,0.3) !important;
}
.cx-fab:active {
  transform: scale(0.94);
}
.cx-fab.cx-has-unread {
  animation: cx-fab-gradient 4s ease infinite, cx-fab-pulse 1.5s ease-in-out infinite !important;
}

/* ─── Barra de modos ─── */
.cx-mode-bar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.cx-mode-bar::-webkit-scrollbar { display: none; }

.cx-mode-btn {
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--cx-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  will-change: transform, background;
  font-family: var(--cx-font);
}
.cx-mode-btn:hover {
  background: rgba(212,118,60,0.15);
  border-color: rgba(212,118,60,0.4);
  color: var(--cx-accent);
  transform: translateY(-1px);
}
.cx-mode-btn.cx-active {
  background: linear-gradient(135deg, rgba(212,118,60,0.3), rgba(212,118,60,0.15));
  border-color: rgba(212,118,60,0.6);
  color: var(--cx-accent-hot);
  box-shadow: 0 0 10px rgba(212,118,60,0.2);
}

/* ─── Input area ─── */
.cx-input-area {
  padding: 12px 14px;
  background: rgba(5,5,10,0.8);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.cx-textarea {
  background: rgba(16,16,26,0.95);
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  color: var(--cx-text-primary);
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  will-change: box-shadow;
  padding: 14px 18px;
  font-family: var(--cx-font);
  font-size: 15px;
  line-height: 1.55;
  width: 100%;
  min-height: 54px;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}
.cx-textarea::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari */
}
.cx-textarea::placeholder {
  color: var(--cx-text-muted);
  opacity: 0.6;
}
.cx-textarea:focus {
  border-color: rgba(212,118,60,0.45);
  box-shadow: 0 0 0 3px rgba(212,118,60,0.1), inset 0 0 12px rgba(212,118,60,0.04);
}

/* ─── Notificación push ─── */
.cx-push-notif {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 360px;
  max-width: 500px;
  background: rgba(12,12,20,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 14px;
  border: 1px solid rgba(212,118,60,0.4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 30px rgba(212,118,60,0.15);
  padding: 14px 18px;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: top 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease, margin-top 0.3s ease;
  will-change: top, opacity;
  pointer-events: all;
}
.cx-push-notif.cx-push-visible { top: 16px; }

.cx-push-notif.cx-push-price {
  border-color: rgba(0,255,136,0.5);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 30px rgba(0,255,136,0.2);
  animation: cx-border-flash-green 1s ease-in-out 3;
}
.cx-push-notif.cx-push-minimum {
  border-color: rgba(255,80,80,0.7);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(255,80,80,0.3);
  animation: cx-border-flash-red 0.5s ease-in-out infinite;
}
.cx-push-notif.cx-push-buzz {
  border-color: rgba(255,200,0,0.7);
  animation: cx-border-flash-yellow 0.3s ease-in-out 6;
}

.cx-push-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}
.cx-push-body { flex: 1; min-width: 0; }
.cx-push-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cx-text-primary);
  margin-bottom: 2px;
}
.cx-push-text {
  font-size: 12px;
  color: var(--cx-text-muted);
  line-height: 1.4;
}
.cx-push-ts {
  font-size: 10px;
  color: var(--cx-text-muted);
  margin-top: 4px;
  opacity: 0.7;
}
.cx-push-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--cx-text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.cx-push-close:hover {
  background: rgba(255,255,255,0.15);
  color: var(--cx-text-primary);
}
.cx-push-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cx-push-btn {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(212,118,60,0.4);
  background: rgba(212,118,60,0.15);
  color: var(--cx-accent-hot);
  transition: all 0.15s ease;
}
.cx-push-btn:hover {
  background: rgba(212,118,60,0.3);
}

/* ─── Drop-up de @menciones ─── */
.cx-mention-dropup, .cx-product-dropup {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: rgba(14,14,22,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212,118,60,0.3);
  border-radius: 12px 12px 0 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
  animation: cx-dropup-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.cx-mention-item, .cx-product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cx-mention-item:hover, .cx-mention-item.cx-selected,
.cx-product-item:hover, .cx-product-item.cx-selected {
  background: rgba(212,118,60,0.15);
}

/* ─── Pill de mención en input ─── */
.cx-mention-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(212,118,60,0.2);
  border: 1px solid rgba(212,118,60,0.4);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--cx-accent-hot);
  vertical-align: middle;
  cursor: default;
}
.cx-product-pill {
  background: rgba(0,212,255,0.15);
  border-color: rgba(0,212,255,0.35);
  color: var(--cx-neon-blue);
}

/* ─── Self mention highlight ─── */
.cx-self-mention {
  background: rgba(212,118,60,0.25);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--cx-accent-hot);
  font-weight: 600;
}

/* ─── Media y adjuntos ─── */
.cx-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.cx-media-thumb {
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
  background: rgba(0,0,0,0.3);
}
.cx-media-thumb:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}
.cx-media-thumb img, .cx-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cx-media-lazy { opacity: 0; transition: opacity 0.3s ease; }
.cx-media-lazy.cx-loaded { opacity: 1; }

/* Drop zone activa */
.cx-drop-active .cx-messages::after {
  content: '📁 Soltá aquí';
  position: absolute;
  inset: 0;
  background: rgba(212,118,60,0.12);
  border: 2px dashed rgba(212,118,60,0.6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--cx-accent);
  z-index: 100;
  animation: cx-drop-pulse 1s ease-in-out infinite;
  pointer-events: none;
}

/* ─── Mini reproductor TTS ─── */
.cx-tts-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(136,0,255,0.12);
  border: 1px solid rgba(136,0,255,0.3);
  border-radius: 24px;
  padding: 6px 12px;
  margin-top: 8px;
}
.cx-tts-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(136,0,255,0.4);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  font-size: 12px;
}
.cx-tts-btn:hover { background: rgba(136,0,255,0.7); transform: scale(1.1); }
.cx-tts-waveform { width: 80px; height: 24px; }
.cx-tts-speed {
  font-size: 10px;
  color: var(--cx-neon-purple);
  cursor: pointer;
  padding: 2px 6px;
  border: 1px solid rgba(136,0,255,0.3);
  border-radius: 10px;
  transition: all 0.15s ease;
}
.cx-tts-speed:hover { background: rgba(136,0,255,0.2); }

/* ─── Mic button grabando (en input row) ─── */
.cx-btn-mic.cx-mic-recording {
  animation: cx-mic-pulse 0.8s ease-in-out infinite;
}

/* ─── Typing indicator ─── */
.cx-typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}
.cx-typing-indicator.cx-show { display: flex; }
.cx-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cx-accent);
  animation: cx-typing-bounce 1.2s ease-in-out infinite;
}
.cx-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cx-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ─── Canvas de partículas ─── */
#cx-canvas-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: var(--cx-radius);
  will-change: transform;
}

/* ─── Header v2 ─── */
.cx-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(15,15,22,0.8);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 10px;
  min-height: 52px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.cx-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-hot));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  animation: cx-fab-gradient 4s ease infinite;
  background-size: 200% 200%;
}
.cx-header-info { flex: 1; min-width: 0; }
.cx-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--cx-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Voice player en header ─── */
.cx-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  transition: opacity 0.2s ease;
}
.cx-header-title-wrap.cx-hidden { display: none; }

/* Estados del voice player */
.cx-voice-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cx-voice-play-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-hot));
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(212,118,60,0.4), 0 4px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  padding: 0;
}
.cx-voice-play-btn::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(212,118,60,0.3);
  animation: cx-voice-ring 2s ease-out infinite;
  pointer-events: none;
}
.cx-voice-play-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 0 20px rgba(212,118,60,0.6), 0 6px 12px rgba(0,0,0,0.4);
}
.cx-voice-play-btn.cx-playing {
  background: linear-gradient(135deg, var(--cx-neon-purple), var(--cx-neon-blue));
  box-shadow: 0 0 15px rgba(136,0,255,0.5), 0 4px 8px rgba(0,0,0,0.3);
}
.cx-voice-play-btn.cx-playing::before {
  border-color: rgba(136,0,255,0.4);
}
@keyframes cx-voice-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.cx-voice-wave {
  width: 80px;
  height: 24px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.cx-voice-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--cx-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}
.cx-header-status {
  font-size: 12px;
  color: var(--cx-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.cx-header-realtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cx-offline);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.cx-header-realtime-dot.cx-connected {
  background: var(--cx-online);
  box-shadow: 0 0 8px var(--cx-online);
}
.cx-header-mute-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--cx-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.cx-header-mute-btn:hover {
  background: rgba(212,118,60,0.15);
  color: var(--cx-accent);
}
.cx-header-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--cx-text-muted);
  font-size: 16px;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.cx-header-close:hover { background: rgba(255,255,255,0.08); color: var(--cx-text-primary); }

/* ─── Messages area ─── */
.cx-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,118,60,0.3) transparent;
}
.cx-messages::-webkit-scrollbar { width: 4px; }
.cx-messages::-webkit-scrollbar-thumb {
  background: rgba(212,118,60,0.3);
  border-radius: 2px;
}

/* ─── Msg row ─── */
.cx-msg-row {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: cx-msg-in-slide-right 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.cx-msg-row.cx-msg-in, .cx-msg-row.cx-msg-ai {
  align-self: flex-start;
  animation: cx-msg-in-slide-left 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.cx-msg-row.cx-msg-out {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cx-msg-row.cx-msg-system { align-self: center; max-width: 95%; animation: cx-system-glow 3s ease-in-out infinite alternate; }

.cx-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cx-user-color, #555);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 4px;
}

.cx-msg-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-bubble {
  padding: 11px 15px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  position: relative;
}
.cx-msg-text a {
  color: var(--cx-accent-hot);
  text-decoration: underline;
  word-break: break-all;
}

.cx-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--cx-text-muted);
  padding: 0 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.cx-msg-row:hover .cx-msg-meta { opacity: 1; }

.cx-msg-actions {
  display: none;
  gap: 4px;
  position: absolute;
  top: -10px;
  right: 8px;
}
.cx-msg-row:hover .cx-msg-actions { display: flex; }
.cx-msg-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cx-bg-glass);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--cx-text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.cx-msg-action-btn:hover {
  background: rgba(212,118,60,0.2);
  color: var(--cx-accent);
  transform: scale(1.1);
}

.cx-reaction-bar {
  display: none;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(20,20,32,0.9);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}
.cx-reaction-bar.cx-show { display: flex; }
.cx-reaction-emoji {
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 6px;
  transition: transform 0.15s ease;
  line-height: 1;
}
.cx-reaction-emoji:hover { transform: scale(1.3); }
.cx-reaction-count {
  font-size: 10px;
  color: var(--cx-text-muted);
  margin-left: 2px;
}

/* ─── Reply preview ─── */
.cx-reply-preview {
  display: none;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--cx-accent);
  border-radius: 0 8px 8px 0;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--cx-text-muted);
}
.cx-reply-preview.cx-show { display: block; }
.cx-reply-preview-name { font-weight: 600; color: var(--cx-accent); }
.cx-reply-preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-reply-preview-close {
  float: right;
  cursor: pointer;
  color: var(--cx-text-muted);
  font-size: 12px;
  margin-left: 8px;
}

/* ─── Attachments preview ─── */
.cx-attachments-preview {
  display: none;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cx-attachments-preview.cx-show { display: flex; }
.cx-attach-item {
  width: 80px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(20,20,32,0.9);
  border: 1px solid rgba(255,255,255,0.06);
}
.cx-attach-thumb { width: 80px; height: 60px; object-fit: cover; display: block; }
.cx-attach-info {
  padding: 4px 6px;
  font-size: 9px;
  color: var(--cx-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cx-attach-progress {
  height: 2px;
  background: rgba(212,118,60,0.3);
  width: 0%;
  transition: width 0.2s ease;
}
.cx-attach-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.cx-attach-remove:hover { background: rgba(255,60,60,0.8); }

/* ─── Voice waveform row ─── */
.cx-voice-waveform-row {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.cx-voice-waveform-row.cx-show { display: flex; }
.cx-voice-timer {
  font-size: 13px;
  font-weight: 700;
  color: var(--cx-accent);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
#cx-voice-waveform {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  background: rgba(20,20,32,0.5);
}

/* ─── Input row ─── */
.cx-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  background: rgba(12,12,18,0.6);
  border-radius: 20px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.cx-input-main { flex: 1; min-width: 0; }
.cx-input-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-bottom: 1px;
}
.cx-btn-attach, .cx-btn-mic {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--cx-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.cx-btn-attach:hover, .cx-btn-mic:hover {
  background: rgba(255,255,255,0.06);
  color: var(--cx-accent);
  transform: scale(1.08);
}
.cx-btn-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-hot));
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.cx-btn-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(212,118,60,0.45);
}
.cx-btn-send:active { transform: scale(0.95); }

/* ─── Lightbox ─── */
.cx-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cx-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transition: transform 0.2s ease;
}
.cx-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.cx-lightbox-close:hover { background: rgba(255,255,255,0.2); }
.cx-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.cx-lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.cx-lightbox-prev { left: 16px; }
.cx-lightbox-next { right: 16px; }
.cx-lightbox-download {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cx-lightbox-download:hover { background: rgba(255,255,255,0.2); }

/* ─── Audio player en mensaje ─── */
.cx-audio-player-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 20px;
  padding: 4px 10px;
}
.cx-audio-play-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(212,118,60,0.4);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.cx-audio-play-btn:hover { background: rgba(212,118,60,0.7); }
.cx-audio-seek {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  cursor: pointer;
}
.cx-audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cx-accent);
  cursor: pointer;
}
.cx-audio-time {
  font-size: 10px;
  color: var(--cx-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

/* ─── GPU rules ─── */
.cx-panel, .cx-fab, .cx-push-notif, .cx-user-row,
.cx-bubble, .cx-media-thumb, .cx-mode-btn,
.cx-typing-dot, .cx-online-dot {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   FILE PICKER — Modal custom tematizado
   ═══════════════════════════════════════════════════════════════ */
.cx-filepicker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,5,10,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.cx-filepicker-overlay.cx-show {
  opacity: 1;
  pointer-events: all;
}

.cx-filepicker-modal {
  background: var(--cx-bg-panel);
  border: 1px solid rgba(212,118,60,0.3);
  border-radius: var(--cx-radius);
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 80px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.9), 0 0 40px rgba(212,118,60,0.15);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
.cx-filepicker-modal.cx-show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cx-filepicker-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 15px;
  font-weight: 700;
  color: var(--cx-text-primary);
}
.cx-filepicker-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--cx-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}
.cx-filepicker-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--cx-text-primary);
}

.cx-filepicker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px;
}

.cx-filepicker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(20,20,32,0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  color: inherit;
  text-decoration: none;
  outline: none;
}
.cx-filepicker-card:hover {
  background: rgba(212,118,60,0.12);
  border-color: rgba(212,118,60,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}
.cx-filepicker-card:active {
  transform: scale(0.96);
}
.cx-filepicker-icon {
  font-size: 28px;
  line-height: 1;
}
.cx-filepicker-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--cx-text-primary);
  text-align: center;
}
.cx-filepicker-desc {
  font-size: 9px;
  color: var(--cx-text-muted);
  text-align: center;
  line-height: 1.3;
  max-width: 90px;
}

.cx-filepicker-dropzone {
  margin: 0 16px 16px;
  padding: 16px;
  border-radius: 12px;
  border: 2px dashed rgba(212,118,60,0.2);
  background: rgba(212,118,60,0.04);
  text-align: center;
  font-size: 12px;
  color: var(--cx-text-muted);
  transition: all 0.2s ease;
}
.cx-filepicker-dropzone.cx-drop-hover {
  border-color: var(--cx-accent);
  background: rgba(212,118,60,0.1);
  color: var(--cx-accent);
}

/* ─── Camera overlay ─── */
.cx-camera-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cx-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cx-camera-shutter {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.cx-camera-shutter:hover {
  background: rgba(255,255,255,0.4);
  transform: translateX(-50%) scale(1.08);
}
.cx-camera-shutter:active {
  transform: translateX(-50%) scale(0.92);
}
.cx-camera-cancel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Drag + Resize handles ─── */
.cx-header {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.cx-header:active {
  cursor: grabbing;
}
.cx-resize-handle {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: transparent;
}
.cx-resize-handle::before,
.cx-resize-handle::after {
  content: '';
  position: absolute;
  right: 2px;
  bottom: 2px;
  border-right: 2px solid rgba(212,118,60,0.5);
  border-bottom: 2px solid rgba(212,118,60,0.5);
  pointer-events: none;
}
.cx-resize-handle::before {
  width: 8px;
  height: 8px;
}
.cx-resize-handle::after {
  width: 4px;
  height: 4px;
}
.cx-panel:hover .cx-resize-handle {
  opacity: 1;
}

/* ─── Panel main ─── */
.cx-panel-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* ─── Cursor typewriter ─── */
.cx-typewriter-cursor {
  display: inline;
  animation: cx-cursor-blink 0.8s step-end infinite;
  color: var(--cx-neon-purple);
}
@keyframes cx-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── Ver más / expandir ─── */
.cx-msg-expand-btn {
  color: var(--cx-accent);
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 4px;
  display: inline-block;
}
.cx-msg-text.cx-truncated {
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.cx-msg-text.cx-truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(transparent, var(--cx-bg-glass));
  pointer-events: none;
}

/* ─── Notifications stack ─── */
#cx-notifications {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}
#cx-notifications .cx-push-notif { position: relative; top: auto !important; transform: none !important; }
#cx-notifications .cx-push-notif.cx-push-visible { animation: cx-notif-stack-down 0.3s cubic-bezier(0.34,1.56,0.64,1); }

/* ─── Galería ─── */
.cx-gallery-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: 10px;
}
.cx-gallery-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.cx-gallery-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--cx-text);
}
.cx-gallery-status {
  min-width: 0;
  text-align: right;
  font-size: 11px;
  color: var(--cx-muted);
}
.cx-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}
.cx-gallery-card {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}
.cx-gallery-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgba(0,0,0,0.24);
}
.cx-gallery-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.cx-gallery-name {
  overflow: hidden;
  color: var(--cx-text);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-gallery-actions {
  display: flex;
  justify-content: flex-end;
}
.cx-gallery-include {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(212,118,60,0.45);
  border-radius: 7px;
  background: rgba(212,118,60,0.14);
  color: var(--cx-accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.cx-gallery-include:hover {
  background: rgba(212,118,60,0.22);
}
.cx-gallery-include:disabled {
  cursor: default;
  opacity: 0.82;
}
.cx-gallery-include.cx-gallery-selected {
  border-color: rgba(0,255,136,0.45);
  background: rgba(0,255,136,0.12);
  color: #8dffbf;
}

/* ─── KEYFRAMES COMPLETOS ─── */
@keyframes cx-pulse-online {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
@keyframes cx-fab-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes cx-fab-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(212,118,60,0.6), 0 0 0 0 rgba(212,118,60,0.4); }
  50% { box-shadow: 0 4px 20px rgba(212,118,60,0.6), 0 0 0 12px rgba(212,118,60,0); }
}
@keyframes cx-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, -3px); }
  20% { transform: translate(6px, 3px); }
  30% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  50% { transform: translate(-2px, 1px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 0); }
  90% { transform: translate(0, 1px); }
}
@keyframes cx-typing-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes cx-dropup-in {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes cx-drop-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes cx-system-glow {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
@keyframes cx-border-flash-green {
  0%, 100% { border-color: rgba(0,255,136,0.5); }
  50% { border-color: rgba(0,255,136,0.9); }
}
@keyframes cx-border-flash-red {
  0%, 100% { border-color: rgba(255,80,80,0.7); }
  50% { border-color: rgba(255,80,80,1); }
}
@keyframes cx-border-flash-yellow {
  0%, 100% { border-color: rgba(255,200,0,0.7); }
  50% { border-color: rgba(255,200,0,1); }
}
@keyframes cx-mic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
@keyframes cx-msg-in-slide-left {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes cx-msg-in-slide-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes cx-ai-typewriter {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes cx-notif-stack-down {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes cx-waveform-bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
@keyframes cx-user-slide-in {
  0% { transform: translateX(-20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes cx-user-fade-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}
@keyframes cx-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── Responsive ─── */
@media (max-width: 520px) {
  .cx-panel {
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    height: calc(100vh - 100px) !important;
    max-height: calc(100vh - 100px) !important;
    bottom: 84px !important;
    right: 8px !important;
    left: 8px !important;
    border-radius: var(--cx-radius) !important;
  }
  .cx-sidebar-left.cx-sidebar-expanded { display: flex !important; }
  .cx-sidebar-left:not(.cx-sidebar-expanded) { display: none !important; }
  .cx-fab { bottom: 16px; right: 16px; }
}
@media (max-width: 480px) {
  .cx-panel {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    border-radius: 0 !important;
    border: none !important;
  }
  .cx-sidebar-left.cx-sidebar-expanded { display: flex !important; }
  .cx-sidebar-left:not(.cx-sidebar-expanded) { display: none !important; }
  .cx-fab { bottom: 16px; right: 16px; }
}
@media (max-width: 380px) {
  .cx-mode-btn { padding: 5px 8px; font-size: 10px; }
  .cx-mode-btn .cx-mode-icon { display: inline; }
  .cx-mode-btn .cx-mode-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .cx-online-dot, .cx-typing-dot {
    animation: none !important;
  }
}

/* WLM Buzz shake effect */
.cx-panel.cx-buzzing {
  animation: cx-shake 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 40px rgba(255, 200, 0, 0.6) !important;
  border-color: rgba(255, 200, 0, 0.8) !important;
}
@keyframes cx-buzz-flash {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(255, 200, 0, 0); opacity: 0; }
  20% { box-shadow: inset 0 0 20px 2px rgba(255, 200, 0, 0.8); opacity: 1; }
  40% { box-shadow: inset 0 0 30px 4px rgba(255, 150, 0, 0.6); opacity: 0.8; }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 200, 0, 0); opacity: 0; }
}
