/* ============================================================
   RADIOWAVE v3.1 — buzz-voice.css
   BUZZ Screen Shake · Voice Messages · Recorder UI
   ============================================================ */

/* ── BUZZ ANIMATION ── */
@keyframes buzzShake {
  0%   { transform: translate(0,0) rotate(0deg); }
  5%   { transform: translate(-4px,-3px) rotate(-1.5deg); }
  10%  { transform: translate(4px,3px) rotate(1.5deg); }
  15%  { transform: translate(-6px,2px) rotate(-1deg); }
  20%  { transform: translate(6px,-2px) rotate(1deg); }
  25%  { transform: translate(-4px,4px) rotate(-0.5deg); }
  30%  { transform: translate(4px,-4px) rotate(0.5deg); }
  35%  { transform: translate(-3px,3px) rotate(-1deg); }
  40%  { transform: translate(3px,-3px) rotate(1deg); }
  50%  { transform: translate(-2px,2px) rotate(-0.5deg); }
  60%  { transform: translate(2px,-1px) rotate(0deg); }
  70%  { transform: translate(-1px,1px) rotate(0deg); }
  80%  { transform: translate(1px,0px) rotate(0deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}

@keyframes buzzFlash {
  0%,100% { opacity: 1; }
  10%  { opacity: 0.85; background: rgba(255,77,77,.12); }
  20%  { opacity: 1; }
  30%  { opacity: 0.88; background: rgba(255,77,77,.08); }
  50%  { opacity: 1; }
  70%  { opacity: 0.92; background: rgba(255,77,77,.05); }
}

@keyframes buzzRipple {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3.5); opacity: 0; }
}

@keyframes buzzBounce {
  0%,100% { transform: scale(1); }
  20%     { transform: scale(1.3) rotate(-5deg); }
  40%     { transform: scale(0.9) rotate(5deg); }
  60%     { transform: scale(1.15) rotate(-3deg); }
  80%     { transform: scale(0.95) rotate(2deg); }
}

/* Applied to body when BUZZ received */
body.buzzing {
  animation: buzzShake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}
body.buzzing .chat-window {
  animation: buzzFlash 0.6s ease;
}

/* BUZZ notification overlay */
.buzz-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99998;
  display: none;
}
.buzz-overlay.show { display: block; }
.buzz-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 80px; height: 80px;
  margin: -40px 0 0 -40px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  animation: buzzRipple 0.8s ease-out forwards;
}
.buzz-ring:nth-child(2) { animation-delay: 0.15s; }
.buzz-ring:nth-child(3) { animation-delay: 0.30s; }

/* BUZZ notification toast */
.buzz-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) scale(0);
  background: var(--bg1);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 20px 30px;
  text-align: center;
  z-index: 99999;
  box-shadow: 0 0 0 4px rgba(255,77,77,.2), 0 20px 60px rgba(0,0,0,.6);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  min-width: 200px;
}
.buzz-toast.show { transform: translate(-50%,-50%) scale(1); }
.buzz-toast-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
  animation: buzzBounce 0.6s ease;
}
.buzz-toast-from {
  font-size: 14px;
  color: var(--txt2);
  font-family: var(--fm);
}
.buzz-toast-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  font-family: var(--fd);
  margin-top: 4px;
}

/* BUZZ button in chat input */
.buzz-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--bdr2);
  color: var(--txt3);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.buzz-btn:hover {
  background: rgba(255,77,77,.12);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
}
.buzz-btn.sending {
  animation: buzzBounce 0.4s ease;
}

/* Bubble BUZZ message */
.bubble.buzz-msg {
  background: linear-gradient(135deg, rgba(255,77,77,.15), rgba(255,77,77,.05));
  border: 1px solid rgba(255,77,77,.3);
  color: var(--accent);
  font-family: var(--fd);
  font-size: 16px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.buzz-msg-icon { font-size: 20px; animation: buzzBounce 0.5s ease; }

/* ══════════════════════════════════════════════════════════
   VOICE MESSAGES
   ══════════════════════════════════════════════════════════ */

/* Record button */
.voice-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--bdr2);
  color: var(--txt3);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.voice-btn:hover {
  background: rgba(77,159,255,.12);
  border-color: var(--blue);
  color: var(--blue);
}
.voice-btn.recording {
  background: rgba(255,77,77,.15);
  border-color: var(--accent);
  color: var(--accent);
  animation: recPulse 1s ease-in-out infinite;
}
@keyframes recPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,77,77,.4); }
  50%     { box-shadow: 0 0 0 8px rgba(255,77,77,0); }
}

/* Recording status bar */
.recording-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,77,77,.08);
  border: 1px solid rgba(255,77,77,.2);
  border-radius: 10px;
  margin-bottom: 6px;
  animation: fadeIn 0.2s ease;
}
.recording-bar.show { display: flex; }
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }

.rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: recPulse 1s ease-in-out infinite;
  flex-shrink: 0;
}
.rec-label {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--fm);
  flex: 1;
}
.rec-timer {
  font-family: var(--fm);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}
.rec-waveform {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 20px;
  flex: 1;
}
.rec-waveform span {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: recWave 0.8s ease-in-out infinite;
  min-height: 3px;
}
.rec-waveform span:nth-child(odd)  { animation-delay: 0.1s; }
.rec-waveform span:nth-child(3n)   { animation-delay: 0.2s; }
.rec-waveform span:nth-child(4n)   { animation-delay: 0.3s; }
@keyframes recWave {
  0%,100% { height: 4px; }
  50%     { height: 16px; }
}

.rec-cancel {
  background: none; border: 1px solid var(--bdr2);
  border-radius: 6px; padding: 3px 8px;
  font-size: 11px; color: var(--txt3); cursor: pointer;
  transition: all 0.15s; flex-shrink: 0;
}
.rec-cancel:hover { color: var(--accent); border-color: var(--accent); }
.rec-send {
  background: var(--accent); border: none;
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; color: #fff; cursor: pointer;
  transition: all 0.15s; flex-shrink: 0;
}
.rec-send:hover { background: #ff3333; }

/* Voice message bubble */
.voice-bubble {
  background: var(--bg3);
  border: 1px solid var(--bdr2);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  max-width: 280px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.voice-bubble:hover { background: var(--bg2); }
.voice-bubble.me {
  background: linear-gradient(135deg, var(--chat-accent) 0%, rgba(0,0,0,.2) 120%);
  border-color: transparent;
}
.voice-bubble.me:hover { opacity: 0.9; }

.vb-play-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.voice-bubble:not(.me) .vb-play-btn {
  background: var(--chat-accent);
}
.vb-play-btn:hover { background: rgba(255,255,255,.25); }
.vb-play-btn.playing { }

.vb-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  cursor: pointer;
  overflow: hidden;
}
.vb-bar {
  flex: 1;
  border-radius: 2px;
  background: rgba(255,255,255,.3);
  min-width: 3px;
  min-height: 3px;
  transition: background 0.15s;
  cursor: pointer;
}
.vb-bar.played { background: rgba(255,255,255,.8); }
.voice-bubble:not(.me) .vb-bar { background: rgba(255,255,255,.2); }
.voice-bubble:not(.me) .vb-bar.played { background: var(--chat-accent); }

.vb-duration {
  font-family: var(--fm);
  font-size: 11px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  flex-shrink: 0;
}
.voice-bubble:not(.me) .vb-duration { color: var(--txt3); }

/* Voice msg progress overlay */
.vb-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: rgba(255,255,255,.5);
  border-radius: 0 0 16px 16px;
  transition: width 0.1s linear;
  pointer-events: none;
}
