/* ═══════════════════════════════════════════════════════════════════════════
   AUDIO SYSTEM CSS — Premium Voice Recorder + Player
   Competitivo com: Telegram, Discord, iMessage, WhatsApp
   
   Regras:
   - ZERO inline styles
   - ZERO classes de framework (Tailwind, Bootstrap)
   - Somente GPU-accelerated properties nas animações
   - transform, opacity, filter, clip-path apenas
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════
   §1 — KEYFRAMES
   ═══════════════════════════ */

@keyframes audio-pulse-ring {
  0%   { transform: scale(1);    opacity: 0.7; }
  100% { transform: scale(2.4);  opacity: 0; }
}

@keyframes audio-pulse-core {
  0%, 100% { transform: scale(1.0); }
  50%       { transform: scale(1.08); }
}

@keyframes audio-record-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--audio-accent-rec-glow), var(--audio-shadow-md); }
  50%       { box-shadow: 0 0 0 8px transparent, var(--audio-shadow-md); }
}

@keyframes audio-slide-cancel-arrow {
  0%, 100% { transform: translateX(0); opacity: 0.7; }
  50%       { transform: translateX(4px); opacity: 1; }
}

@keyframes audio-lock-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}

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

@keyframes audio-fade-in-up {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes audio-fade-out-down {
  from { opacity: 1; transform: translateY(0)   scale(1); }
  to   { opacity: 0; transform: translateY(6px) scale(0.94); }
}

@keyframes audio-morph-in {
  from { opacity: 0; transform: scale(0.6) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0deg); }
}

@keyframes audio-morph-out {
  from { opacity: 1; transform: scale(1)   rotate(0deg); }
  to   { opacity: 0; transform: scale(0.6) rotate(15deg); }
}

@keyframes audio-waveform-cancel {
  0%   { transform: scale(1); opacity: 1; filter: blur(0px); }
  100% { transform: scale(0); opacity: 0; filter: blur(8px); }
}

@keyframes audio-overlay-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes audio-ripple {
  0%   { transform: scale(0);   opacity: 0.5; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes audio-breathing {
  0%, 100% { opacity: 0.85; }
  50%       { opacity: 1; }
}

/* ═══════════════════════════
   §2 — RECORDER OVERLAY
   ═══════════════════════════ */

/* Overlay principal — substitui completamente o input quando gravando */
.ar-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 0 12px 0 8px;
  background: var(--audio-surface);
  backdrop-filter: blur(var(--audio-blur-radius));
  -webkit-backdrop-filter: blur(var(--audio-blur-radius));
  border-top: 1px solid var(--audio-border);
  border-radius: 0 0 14px 14px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  gap: 10px;
  will-change: opacity, transform;
}

/* Estado visível — controlado por JS via .is-visible */
.ar-overlay {
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.22s var(--audio-ease-smooth),
              transform 0.22s var(--audio-ease-expo-out);
}
.ar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  animation: audio-overlay-in 0.25s var(--audio-ease-expo-out) both;
}

/* ── Botão Cancelar (lixeira) — visível no modo locked ── */
.ar-btn-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--audio-btn-size);
  height: var(--audio-btn-size);
  border-radius: var(--audio-radius-btn);
  font-size: 19px;
  line-height: 1;
  border: none;
  background: var(--audio-accent-rec-dim);
  color: var(--audio-accent-recording);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: background 0.2s var(--audio-ease-smooth),
              transform 0.18s var(--audio-ease-spring);
  will-change: transform;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}
.ar-btn-cancel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  animation: audio-morph-in 0.28s var(--audio-ease-spring) both;
}
.ar-btn-cancel:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: scale(1.08);
}
.ar-btn-cancel:active {
  transform: scale(0.92);
}

/* ── Área Central (mic pulsante + timer + waveform) ── */
.ar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* ── Mic Pulsante (durante gravação) ── */
.ar-mic-pulse {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ar-mic-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--audio-accent-recording);
  opacity: 0;
  will-change: transform, opacity;
}
.ar-overlay.is-visible .ar-mic-pulse-ring {
  animation: audio-pulse-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.ar-mic-pulse-core {
  position: relative;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--audio-accent-recording);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--audio-shadow-rec);
  will-change: transform;
}
.ar-overlay.is-visible .ar-mic-pulse-core {
  animation: audio-pulse-core 2s ease-in-out infinite;
}

.ar-mic-pulse-core svg {
  width: 12px;
  height: 12px;
  fill: #ffffff;
}

/* ── Timer ── */
.ar-timer {
  font-family: var(--audio-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--audio-text-primary);
  min-width: 42px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Canvas do Live Waveform ── */
.ar-waveform-canvas {
  flex: 1;
  min-width: 0;
  height: 24px;
  display: block;
  /* Canvas é configurado via JS com DPR correto */
}

/* ── "Deslize para cancelar" ── */
.ar-slide-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--audio-text-secondary);
  font-family: var(--audio-font-ui);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
  pointer-events: none;
  will-change: opacity, transform;
  transition: opacity 0.1s linear, transform 0.1s linear;
}

.ar-slide-hint-arrow {
  display: inline-block;
  animation: audio-slide-cancel-arrow 1.4s ease-in-out infinite;
}

/* ── Botão Enviar — visível no modo locked ── */
.ar-btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--audio-btn-size);
  height: var(--audio-btn-size);
  border-radius: var(--audio-radius-btn);
  font-size: 19px;
  line-height: 1;
  border: none;
  background: var(--audio-accent);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px var(--audio-accent-glow);
  transition: box-shadow 0.2s var(--audio-ease-smooth),
              transform 0.18s var(--audio-ease-spring);
  will-change: transform;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}
.ar-btn-send.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  animation: audio-morph-in 0.28s var(--audio-ease-spring) both;
}
.ar-btn-send:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--audio-accent-glow);
}
.ar-btn-send:active {
  transform: scale(0.92);
}

/* ── Ripple genérico (JS injeta .ar-ripple no click) ── */
.ar-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  will-change: transform, opacity;
  animation: audio-ripple 0.55s var(--audio-ease-expo-out) forwards;
}

/* ═══════════════════════════
   §3 — LOCK HINT (deslize pra cima)
   ═══════════════════════════ */

.ar-lock-hint {
  position: absolute;
  right: 12px;
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--audio-lock-bg);
  border: 1px solid var(--audio-lock-border);
  border-radius: 22px;
  box-shadow: var(--audio-shadow-md);
  padding: 10px 0;
  pointer-events: none;
  will-change: transform, opacity;
  /* Estado inicial: invisível — JS controla via transform/opacity inline via engine */
  opacity: 0;
  transform: translateY(12px) scale(0.85);
  transition: opacity 0.3s var(--audio-ease-spring),
              transform 0.3s var(--audio-ease-spring);
  z-index: 50;
}
.ar-lock-hint.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ar-lock-hint-arrow {
  color: var(--audio-text-muted);
  font-size: 10px;
  line-height: 1;
  animation: audio-lock-bounce 1.1s ease-in-out infinite;
}

.ar-lock-hint-icon {
  color: var(--audio-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ar-lock-hint-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Locked indicator no topo da seta ── */
.ar-lock-hint.is-locked .ar-lock-hint-icon svg {
  stroke: var(--audio-accent);
}
.ar-lock-hint.is-locked {
  border-color: var(--audio-accent-dim);
  background: rgba(99, 102, 241, 0.06);
}

/* ═══════════════════════════
   §4 — MIC BUTTON (no input bar)
   ═══════════════════════════ */

.audio-mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--audio-mic-size);
  height: var(--audio-mic-size);
  border-radius: var(--audio-radius-btn);
  border: none;
  background: transparent;
  color: var(--audio-accent);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 40;
  overflow: hidden;
  will-change: transform;
  transition: background 0.2s var(--audio-ease-smooth);
  flex-shrink: 0;
}

.audio-mic-btn svg {
  pointer-events: none;
  will-change: transform, opacity;
  transition: transform 0.2s var(--audio-ease-spring),
              opacity 0.15s var(--audio-ease-smooth);
}

.audio-mic-btn:hover {
  background: var(--audio-accent-dim);
}

.audio-mic-btn.is-recording {
  background: var(--audio-accent-rec-dim);
  color: var(--audio-accent-recording);
  animation: audio-record-glow 2s ease-in-out infinite;
}

/* ═══════════════════════════
   §5 — AUDIO PLAYER BUBBLE (PREMIUM GLASSMORPHISM)
   ═══════════════════════════ */

@keyframes ap-pulse-time {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes ap-waveform-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.2)); }
  50% { filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.4)); }
}

@keyframes ap-waveform-glow-me {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2)); }
  50% { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3)); }
}

.ap-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 200px;
  max-width: 100%;
  min-height: var(--audio-player-height);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.ap-wrapper.is-me {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(129, 140, 248, 0.15));
  backdrop-filter: blur(12px) saturate(200%);
  -webkit-backdrop-filter: blur(12px) saturate(200%);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.ap-wrapper.is-them {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.ap-wrapper:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.ap-wrapper.is-me:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(129, 140, 248, 0.25));
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

.ap-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--audio-btn-size);
  height: var(--audio-btn-size);
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(79, 70, 229, 0.8));
  color: white;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ap-wrapper.is-me .ap-play-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.85));
  color: #6366f1;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.ap-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.ap-wrapper.is-me .ap-play-btn:hover {
  box-shadow: 0 6px 16px rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.95));
}

.ap-play-btn:active {
  transform: scale(0.95);
}

.ap-wrapper.is-loading .ap-play-btn {
  opacity: 0.7;
}

.ap-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  position: absolute;
  transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ap-icon-play { opacity: 1; }
.ap-icon-pause { opacity: 0; }

.ap-wrapper.is-playing .ap-icon-play { opacity: 0; }
.ap-wrapper.is-playing .ap-icon-pause { opacity: 1; }

.ap-spinner {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: audio-spin 0.8s linear infinite;
}

.ap-wrapper.is-me .ap-spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

.ap-wrapper.is-them .ap-spinner {
  border-color: var(--audio-accent-dim);
  border-top-color: var(--audio-accent);
}

.ap-wrapper.is-loading .ap-spinner { display: block; }

.ap-waveform-area {
  flex: 1;
  height: var(--audio-waveform-height);
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 0 4px;
  transition: background 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ap-waveform-area:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ap-wrapper.is-me .ap-waveform-area {
  background: rgba(255, 255, 255, 0.1);
}

.ap-wrapper.is-me .ap-waveform-area:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ap-waveform-area::before {
  content: '';
  position: absolute;
  inset: -10px 0;
  z-index: 1;
}

.ap-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.ap-seek-cursor {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 2px;
  height: 100%;
  background: rgba(99, 102, 241, 0.6);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 150ms ease-out, left 75ms linear;
  pointer-events: none;
  z-index: 2;
}

.ap-wrapper.is-me .ap-seek-cursor {
  background: rgba(255, 255, 255, 0.8);
}

.ap-waveform-area:hover .ap-seek-cursor {
  opacity: 1;
}

.ap-time {
  font-size: 12px;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
  color: rgba(15, 23, 42, 0.7);
  transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  line-height: 1;
}

.ap-wrapper.is-me .ap-time {
  color: rgba(255, 255, 255, 0.85);
}

.ap-wrapper.is-playing .ap-time {
  animation: ap-pulse-time 1.5s ease-in-out infinite;
}

.ap-wrapper.is-playing .ap-waveform-canvas {
  animation: ap-waveform-glow 2s ease-in-out infinite;
}

.ap-wrapper.is-me.is-playing .ap-waveform-canvas {
  animation: ap-waveform-glow-me 2s ease-in-out infinite;
}

@media (max-width: 480px) {
  .ap-wrapper { padding: 8px 10px; gap: 8px; min-width: 160px; }
  .ap-play-btn { width: 36px; height: 36px; }
  .ap-icon { width: 16px; height: 16px; }
  .ap-waveform-area { height: 32px; padding: 0 3px; }
  .ap-time { font-size: 11px; min-width: 32px; }
}

@media (min-width: 768px) {
  .ap-wrapper { padding: 12px 14px; gap: 12px; min-width: 240px; }
  .ap-play-btn { width: 44px; height: 44px; }
  .ap-icon { width: 20px; height: 20px; }
  .ap-waveform-area { height: 44px; padding: 0 6px; }
  .ap-time { font-size: 13px; min-width: 40px; }
  .ap-play-btn:hover { transform: scale(1.12); }
  .ap-wrapper:hover { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); }
}

.ap-play-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.ap-wrapper.is-me .ap-play-btn:focus-visible {
  outline-color: rgba(255, 255, 255, 0.8);
}

/* ═══════════════════════════
   §6 — REDUCED MOTION
   ═══════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .ap-wrapper, .ap-play-btn, .ap-waveform-area, .ap-seek-cursor, .ap-time {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ar-mic-pulse-ring { animation: none; }
  .ar-mic-pulse-core { animation: none; }
  .ar-lock-hint-arrow { animation: none; }
  .ar-overlay { transition: opacity 0.1s linear; animation: none; }
  .ar-btn-cancel,
  .ar-btn-send { animation: none; transition: opacity 0.1s linear, transform 0.1s linear; }
}

/* ═══════════════════════════
   §7 — ACCESSIBILITY
   ═══════════════════════════ */

.audio-mic-btn:focus-visible,
.ar-btn-cancel:focus-visible,
.ar-btn-send:focus-visible {
  outline: 2px solid var(--audio-accent);
  outline-offset: 2px;
}

/* ── Screen reader only ── */
.ar-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════
   §8 — ESTADO: WAVEFORM CANCEL ANIMATION
   ═══════════════════════════ */

.ar-waveform-canvas.is-cancelling {
  animation: audio-waveform-cancel 0.3s var(--audio-ease-expo-out) forwards;
}


/* Shifting ar-center to make space for the mic button when cancel button is hidden */
.ar-btn-cancel.hidden + .ar-center {
  margin-left: 96px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STICKER PICKER (Figurinhas)
   ═══════════════════════════════════════════════════════════════════════════ */

.sticker-picker-frame {
  background: var(--surface, #fff);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  animation: stickerSlideUp 0.2s ease-out;
}

@keyframes stickerSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sticker-picker-handle {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.sticker-picker-handle-bar {
  width: 36px;
  height: 4px;
  background: var(--muted-color, #ccc);
  border-radius: 4px;
  opacity: 0.5;
}

.sticker-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}

.sticker-picker-body {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 8px 12px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 100px;
}

.sticker-picker-loading {
  width: 100%;
  text-align: center;
  color: var(--muted-color, #999);
  font-size: 13px;
  padding: 32px 0;
  font-style: italic;
}

.sticker-item {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--card-bg, #f0f0f0);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  position: relative;
}

.sticker-item:hover {
  background: var(--surface-2, #f0f0f0);
  transform: scale(1.05);
}

.sticker-item:active {
  transform: scale(0.95);
}

.sticker-add-btn {
  border: 2px dashed var(--muted-color, #ccc);
  border-radius: 12px;
  color: var(--muted-color, #999);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.sticker-del-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
  padding: 0;
}

.sticker-item:hover .sticker-del-btn {
  opacity: 1;
}

.sticker-del-btn:hover {
  background: rgba(220,38,38,0.85);
}

.sticker-add-btn:hover {
  border-color: var(--accent, #8b5cf6);
  color: var(--accent, #8b5cf6);
  background: rgba(139,92,246,0.05);
}

.sticker-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.sticker-gif {
  width: 72px;
  height: 72px;
  object-fit: cover;
}

/* Sticker in chat message */
.sticker-msg-img {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

/* Sticker context menu */
.sticker-context-menu {
  background: var(--surface, #fff);
  border: 1px solid var(--divider, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 200;
  overflow: hidden;
  min-width: 140px;
}

.sticker-context-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.1s;
}

.sticker-context-btn:hover {
  background: var(--surface-2, #f5f5f5);
}

/* Prevent sticker picker from showing behind modals */
.modal-open .sticker-picker-frame {
  z-index: 89;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEDIA BUBBLE — Remove o balão de fundo de mensagens de mídia
   ═══════════════════════════════════════════════════════════════════════════ */

.media-bubble {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 12px !important;
  overflow: visible !important;
}

video.rounded {
  background: #000;
  object-fit: contain;
}

/* Video preview in crop modal */
#chat-crop-container.video-mode {
  height: auto !important;
  min-height: 200px;
  background: #000;
  border: none;
  padding: 0;
}
#chat-crop-container.video-mode video {
  display: block !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL — Impedir overflow horizontal em qualquer tela
   ═══════════════════════════════════════════════════════════════════════════ */

#app-container, #app, #main-content, #chat-area, #active-chat, .chat-view,
#chat-history, #chat-container, .flex-1.overflow-y-auto,
body, html {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

#chat-history .flex {
  max-width: 100% !important;
}

#chat-history .bubble-sent,
#chat-history .bubble-received {
  max-width: 100% !important;
}