/**
 * Sonner Toast & Modern Dialog Extensions
 * Tailored for Biru SaaS Moonlit Theme
 */

/* Container Setup - Posisi Kanan Atas (Top-Right) */
#sonner-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: auto;
  z-index: 9999999;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sonner-toast-container > * {
  pointer-events: auto;
}

/* Custom Overrides for Sonner Toasts */
[data-sonner-toast] {
  --border-radius: 16px !important;
  --padding: 14px 18px !important;
  --width: 380px !important;
  box-shadow: 0 14px 34px -6px rgba(43, 38, 32, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  border-width: 1px !important;
  line-height: 1.45 !important;
}

[data-sonner-toast][data-theme=light] {
  --normal-bg: #FFFFFF !important;
  --normal-border: #E8E2D5 !important;
  --normal-text: #2B2620 !important;
}

[data-sonner-toast][data-type=success] {
  --success-bg: #F0FDF4 !important;
  --success-border: #BBF7D0 !important;
  --success-text: #166534 !important;
}

[data-sonner-toast][data-type=error] {
  --error-bg: #FEF2F2 !important;
  --error-border: #FECACA !important;
  --error-text: #991B1B !important;
}

[data-sonner-toast][data-type=warning] {
  --warning-bg: #FFFBEB !important;
  --warning-border: #FDE68A !important;
  --warning-text: #92400E !important;
}

[data-sonner-toast][data-type=info] {
  --info-bg: #F8FAFC !important;
  --info-border: #E2E8F0 !important;
  --info-text: #1E293B !important;
}

/* Close button inside toast */
.sonner-toast-close {
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #7E776E !important;
  transition: all 0.15s ease !important;
}
.sonner-toast-close:hover {
  background: #C2703D !important;
  color: #FFFFFF !important;
  border-color: #C2703D !important;
}

/* ====================================================================
   SONNER MODERN CONFIRMATION & ALERT DIALOG MODAL
   ==================================================================== */
.sonner-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 18, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.sonner-dialog-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.sonner-dialog-card {
  background: #FFFFFF;
  border: 1px solid #E8E2D5;
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 24px 48px -12px rgba(43, 38, 32, 0.25), 0 8px 16px rgba(0, 0, 0, 0.04);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.sonner-dialog-backdrop.show .sonner-dialog-card {
  transform: scale(1) translateY(0);
}

.sonner-dialog-icon-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  margin-bottom: 16px;
}

.sonner-dialog-icon-badge.info {
  background: #EFF6FF;
  color: #2563EB;
}

.sonner-dialog-icon-badge.warning {
  background: #FEF3C7;
  color: #D97706;
}

.sonner-dialog-icon-badge.danger {
  background: #FEE2E2;
  color: #DC2626;
}

.sonner-dialog-icon-badge.success {
  background: #DCFCE7;
  color: #16A34A;
}

.sonner-dialog-icon-badge.sparkles {
  background: #FFF1E6;
  color: #C2703D;
}

.sonner-dialog-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #2B2620;
  margin-bottom: 8px;
  line-height: 1.35;
}

.sonner-dialog-body {
  font-size: 0.92rem;
  color: #5C554B;
  line-height: 1.55;
  margin-bottom: 24px;
}

.sonner-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.sonner-dialog-actions .btn-dialog-cancel {
  border: 1px solid #DFD8CC;
  background: #FAF7F2;
  color: #5C554B;
  padding: 9px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sonner-dialog-actions .btn-dialog-cancel:hover {
  background: #EFECE6;
  color: #2B2620;
}

.sonner-dialog-actions .btn-dialog-confirm {
  background: #C2703D;
  border: 1px solid #A85A2E;
  color: #FFFFFF;
  padding: 9px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(194, 112, 61, 0.28);
}

.sonner-dialog-actions .btn-dialog-confirm:hover {
  background: #B25F2D;
  box-shadow: 0 6px 16px rgba(194, 112, 61, 0.38);
}

.sonner-dialog-actions .btn-dialog-confirm.danger {
  background: #DC2626;
  border-color: #B91C1C;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.sonner-dialog-actions .btn-dialog-confirm.danger:hover {
  background: #B91C1C;
}

/* ====================================================================
   VOICE WIZARD POPUP STYLES
   ==================================================================== */
.voice-wizard-content {
  border-radius: 24px !important;
  border: 1px solid #E8E2D5 !important;
  box-shadow: 0 25px 60px -15px rgba(43, 38, 32, 0.22) !important;
}

/* Steps Tracker */
.voice-wizard-steps {
  position: relative;
  align-items: center;
  max-width: 580px;
  margin: 0 auto;
}

.voice-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  position: relative;
}

.voice-step-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FAF7F2;
  border: 2px solid #DFD8CC;
  color: #8C8478;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.voice-step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #8C8478;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.voice-step-item.active .voice-step-badge {
  background: #C2703D;
  border-color: #C2703D;
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(194, 112, 61, 0.18);
}

.voice-step-item.active .voice-step-label {
  color: #C2703D;
  font-weight: 700;
}

.voice-step-item.completed .voice-step-badge {
  background: #16A34A;
  border-color: #16A34A;
  color: #FFFFFF;
}

.voice-step-item.completed .voice-step-label {
  color: #16A34A;
}

.voice-step-line {
  flex-grow: 1;
  height: 3px;
  background: #E8E2D5;
  margin: 0 10px 22px 10px;
  z-index: 1;
  transition: background 0.3s ease;
}

.voice-step-line.active {
  background: #C2703D;
}

/* Microphone Button & Pulsing */
.voice-mic-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.voice-record-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C2703D 0%, #A85A2E 100%);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(194, 112, 61, 0.35);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3;
}

.voice-record-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 30px rgba(194, 112, 61, 0.45);
}

.voice-record-btn.recording {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.4);
  animation: micPulse 1.2s infinite ease-in-out;
}

@keyframes micPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.voice-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(220, 38, 38, 0.45);
  opacity: 0;
  pointer-events: none;
}

.voice-record-btn.recording ~ .voice-pulse-ring {
  animation: pulseRing 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Audio Level Visualizer Wave */
.voice-audio-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 26px;
}

.voice-audio-wave span {
  width: 4px;
  background: #DC2626;
  border-radius: 99px;
  animation: waveBar 0.8s ease-in-out infinite alternate;
}

.voice-audio-wave span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.voice-audio-wave span:nth-child(2) { height: 14px; animation-delay: 0.2s; }
.voice-audio-wave span:nth-child(3) { height: 22px; animation-delay: 0.3s; }
.voice-audio-wave span:nth-child(4) { height: 18px; animation-delay: 0.15s; }
.voice-audio-wave span:nth-child(5) { height: 26px; animation-delay: 0.25s; }
.voice-audio-wave span:nth-child(6) { height: 16px; animation-delay: 0.35s; }
.voice-audio-wave span:nth-child(7) { height: 10px; animation-delay: 0.05s; }
.voice-audio-wave span:nth-child(8) { height: 6px; animation-delay: 0.4s; }

@keyframes waveBar {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* Prompt Chips */
.ai-prompt-chip {
  background: #FFFFFF !important;
  border: 1px solid #DFD8CC !important;
  color: #4A4036 !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  transition: all 0.15s ease !important;
  cursor: pointer;
}

.ai-prompt-chip:hover {
  background: #FAF7F2 !important;
  border-color: #C2703D !important;
  color: #C2703D !important;
}
