/**
 * Admin Voice Memo Styles
 * Desktop version of the mobile Voice Memo feature
 * 
 * Allows recording voice notes for CRM contacts with
 * automatic transcription via OpenAI Whisper.
 */

/* ========================================
   VOICE MEMO BUTTON (in contact detail)
   ======================================== */
.voice-memo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-memo-btn:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
}

.voice-memo-btn i {
  font-size: 14px;
}

/* ========================================
   VOICE MEMO MODAL
   ======================================== */
.voice-memo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.voice-memo-modal.open {
  display: flex;
}

.voice-memo-content {
  background: var(--admin-panel, #0e1014);
  border: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.voice-memo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
}

.voice-memo-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--admin-text, #fff);
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-memo-title i {
  color: #a855f7;
}

.voice-memo-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--admin-line-strong, rgba(255, 255, 255, 0.15));
  background: transparent;
  color: var(--admin-text-muted, #a0a0a0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.voice-memo-close:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* ========================================
   RECORDING INTERFACE
   ======================================== */
.voice-memo-body {
  padding: 32px 24px;
  text-align: center;
}

.voice-memo-recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.voice-record-btn {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
  font-size: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.voice-record-btn:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
  transform: scale(1.05);
}

.voice-record-btn.recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  animation: recordPulse 1.5s infinite;
}

@keyframes recordPulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
  }
}

.voice-status {
  font-size: 14px;
  color: var(--admin-text-muted, #a0a0a0);
}

.voice-timer {
  font-family: 'Montserrat', sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--admin-text, #fff);
  font-variant-numeric: tabular-nums;
}

/* Waveform visualization */
.voice-waveform {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
}

.voice-waveform.active {
  display: flex;
}

.voice-waveform-bar {
  width: 4px;
  height: 20px;
  background: #a855f7;
  border-radius: 2px;
  animation: waveformBounce 0.8s ease-in-out infinite;
}

.voice-waveform-bar:nth-child(1) { animation-delay: 0s; height: 15px; }
.voice-waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 25px; }
.voice-waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 35px; }
.voice-waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 25px; }
.voice-waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 15px; }

@keyframes waveformBounce {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ========================================
   AUDIO PREVIEW
   ======================================== */
.voice-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.voice-preview.active {
  display: flex;
}

.voice-preview-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--admin-card, #141414);
  border: 1px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  width: 100%;
}

.voice-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.voice-play-btn:hover {
  transform: scale(1.05);
}

.voice-preview-info {
  flex: 1;
  text-align: left;
}

.voice-preview-duration {
  font-size: 16px;
  font-weight: 600;
  color: var(--admin-text, #fff);
}

.voice-preview-label {
  font-size: 12px;
  color: var(--admin-text-muted, #a0a0a0);
}

/* Playback waveform */
.voice-playback-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
}

.voice-playback-waveform.playing .voice-playback-bar {
  animation: playbackBounce 0.6s ease-in-out infinite;
}

.voice-playback-bar {
  width: 3px;
  height: 12px;
  background: rgba(168, 85, 247, 0.4);
  border-radius: 2px;
}

.voice-playback-bar:nth-child(odd) { height: 8px; }
.voice-playback-bar:nth-child(3n) { height: 16px; }

@keyframes playbackBounce {
  0%, 100% { transform: scaleY(0.6); background: rgba(168, 85, 247, 0.4); }
  50% { transform: scaleY(1); background: #a855f7; }
}

/* ========================================
   TRANSCRIPTION STATUS
   ======================================== */
.voice-transcription-status {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: var(--admin-text-muted, #a0a0a0);
  font-size: 14px;
}

.voice-transcription-status.active {
  display: flex;
}

.voice-transcription-status i {
  animation: spin 1s linear infinite;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */
.voice-memo-actions {
  display: none;
  gap: 12px;
  padding: 0 24px 24px;
}

.voice-memo-actions.active {
  display: flex;
}

.voice-action-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid var(--admin-line-strong, rgba(255, 255, 255, 0.15));
  background: transparent;
  color: var(--admin-text-secondary, #e8e8e8);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.voice-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.voice-action-btn.discard {
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.voice-action-btn.discard:hover {
  background: rgba(239, 68, 68, 0.1);
}

.voice-action-btn.save {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.voice-action-btn.save:hover {
  background: rgba(34, 197, 94, 0.25);
}

/* ========================================
   VOICE NOTE IN NOTES LIST
   ======================================== */
.note-item.voice-note {
  border-left: 3px solid #a855f7;
}

.note-voice-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 6px;
  font-size: 12px;
  color: #a855f7;
  margin-bottom: 8px;
}

.note-audio-player {
  margin-top: 8px;
}

.note-audio-player audio {
  width: 100%;
  height: 32px;
  border-radius: 6px;
}

/* Custom audio player styling */
.note-audio-player audio::-webkit-media-controls-panel {
  background: var(--admin-card, #141414);
}
