/* ==========================================================================
   Dograh Voice AI Widget Styles - TryAutomate.ai
   ========================================================================== */

:root {
  --dw-primary: #4f46e5;
  --dw-primary-hover: #4338ca;
  --dw-secondary: #0ea5e9;
  --dw-accent-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --dw-pulse-gradient: linear-gradient(135deg, rgba(79, 70, 229, 0.4) 0%, rgba(14, 165, 233, 0.4) 100%);
  --dw-dark-bg: #0f172a;
  --dw-surface: #ffffff;
  --dw-surface-subtle: #f8fafc;
  --dw-border: #e2e8f0;
  --dw-text-main: #0f172a;
  --dw-text-muted: #64748b;
  --dw-success: #10b981;
  --dw-danger: #ef4444;
  --dw-danger-hover: #dc2626;
  --dw-shadow-xl: 0 20px 35px -8px rgba(15, 23, 42, 0.22), 0 10px 15px -5px rgba(15, 23, 42, 0.08);
  --dw-glow: 0 0 25px rgba(79, 70, 229, 0.35);
  --dw-radius-xl: 20px;
  --dw-radius-lg: 14px;
}

/* Floating Launcher Button */
.dw-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 10px;
  background: #ffffff;
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 9999px;
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
}

.dw-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 32px -4px rgba(79, 70, 229, 0.25), 0 0 0 1px rgba(79, 70, 229, 0.3);
  border-color: rgba(79, 70, 229, 0.3);
}

.dw-launcher:active {
  transform: translateY(0) scale(0.98);
}

.dw-launcher-icon-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--dw-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

.dw-launcher-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.3s ease;
}

.dw-launcher:hover .dw-launcher-icon {
  transform: scale(1.1);
}

.dw-status-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background-color: var(--dw-success);
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.dw-status-indicator::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--dw-success);
  opacity: 0.75;
  animation: dwIndicatorPing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes dwIndicatorPing {
  0% { transform: scale(0.9); opacity: 0.9; }
  80%, 100% { transform: scale(2); opacity: 0; }
}

.dw-launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.25;
}

.dw-launcher-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dw-text-main);
  letter-spacing: -0.01em;
}

.dw-launcher-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--dw-text-muted);
}

/* Launcher In-Call / Active badge */
.dw-launcher.dw-is-active {
  background: #0f172a;
  border-color: rgba(16, 185, 129, 0.4);
}

.dw-launcher.dw-is-active .dw-launcher-title {
  color: #ffffff;
}

.dw-launcher.dw-is-active .dw-launcher-sub {
  color: var(--dw-success);
}

/* Modal Overlay & Card */
.dw-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99995;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
}

.dw-modal-backdrop.dw-open {
  opacity: 1;
  visibility: visible;
}

.dw-modal-card {
  width: 100%;
  max-width: 410px;
  background: var(--dw-surface);
  border-radius: var(--dw-radius-xl);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: var(--dw-shadow-xl);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  font-family: inherit;
  position: relative;
}

.dw-modal-backdrop.dw-open .dw-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Card Header */
.dw-modal-header {
  padding: 16px 20px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--dw-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dw-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dw-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--dw-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.dw-header-titles h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--dw-text-main);
  letter-spacing: -0.01em;
}

.dw-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dw-success);
}

.dw-header-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--dw-success);
}

.dw-close-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dw-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
  line-height: 1;
}

.dw-close-btn:hover {
  background: #f1f5f9;
  color: var(--dw-text-main);
}

/* Card Body */
.dw-modal-body {
  padding: 22px 20px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

/* Intro Text */
.dw-intro-section {
  text-align: center;
  margin-bottom: 20px;
}

.dw-intro-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--dw-text-main);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.dw-intro-desc {
  font-size: 13px;
  color: var(--dw-text-muted);
  margin: 0;
  line-height: 1.45;
}

/* Form Styles */
.dw-form-group {
  margin-bottom: 18px;
}

.dw-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dw-text-main);
  margin-bottom: 7px;
}

.dw-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.dw-input-icon {
  position: absolute;
  left: 14px;
  color: var(--dw-text-muted);
  font-size: 16px;
  pointer-events: none;
}

.dw-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  font-size: 14px;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius-lg);
  background-color: var(--dw-surface-subtle);
  color: var(--dw-text-main);
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

.dw-input:focus {
  border-color: var(--dw-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.dw-input.dw-has-error {
  border-color: var(--dw-danger);
  background-color: #fffaf0;
}

/* Country Code & Phone Input Component */
.dw-phone-combo {
  display: flex;
  gap: 8px;
  position: relative;
}

/* Country Selector Button */
.dw-country-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius-lg);
  background: var(--dw-surface-subtle);
  color: var(--dw-text-main);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.dw-country-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dw-country-flag {
  font-size: 18px;
  line-height: 1;
}

.dw-country-code-text {
  font-size: 13px;
  font-weight: 600;
}

.dw-chevron {
  font-size: 12px;
  color: var(--dw-text-muted);
  transition: transform 0.2s ease;
}

.dw-country-picker-open .dw-chevron {
  transform: rotate(180deg);
}

/* Phone input */
.dw-phone-input {
  flex: 1;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius-lg);
  background-color: var(--dw-surface-subtle);
  color: var(--dw-text-main);
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.dw-phone-input:focus {
  border-color: var(--dw-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.dw-phone-input.dw-has-error {
  border-color: var(--dw-danger);
  background-color: #fffaf0;
}

/* Dropdown Menu for Countries */
.dw-country-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 250px;
  background: #ffffff;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius-lg);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.dw-country-dropdown.dw-show {
  display: flex;
  animation: dwDropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dwDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dw-country-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--dw-border);
  background: #f8fafc;
  position: relative;
}

.dw-country-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 13px;
  border: 1px solid var(--dw-border);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
}

.dw-country-search-input:focus {
  border-color: var(--dw-primary);
}

.dw-country-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dw-text-muted);
  font-size: 13px;
  pointer-events: none;
}

.dw-country-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}

.dw-country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 13px;
}

.dw-country-item:hover {
  background: #f1f5f9;
}

.dw-country-item.dw-active {
  background: #eef2ff;
  color: var(--dw-primary);
  font-weight: 600;
}

.dw-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dw-item-dial {
  font-size: 12px;
  color: var(--dw-text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

/* Error message label */
.dw-error-msg {
  font-size: 11px;
  color: var(--dw-danger);
  font-weight: 500;
  margin-top: 5px;
  display: none;
}

.dw-error-msg.dw-show {
  display: block;
}

/* Main CTA Button */
.dw-submit-btn {
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: var(--dw-radius-lg);
  background: var(--dw-accent-gradient);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: all 0.25s ease;
  font-family: inherit;
  margin-top: 6px;
}

.dw-submit-btn:hover {
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.45);
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.dw-submit-btn:active {
  transform: translateY(0);
}

.dw-privacy-note {
  font-size: 11px;
  color: var(--dw-text-muted);
  text-align: center;
  margin-top: 14px;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Saved User Card (Returning Visitor) */
.dw-saved-user-card {
  background: #f8fafc;
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius-lg);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.dw-saved-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--dw-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 22px;
  margin: 0 auto 10px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.dw-saved-greeting {
  font-size: 15px;
  font-weight: 700;
  color: var(--dw-text-main);
  margin-bottom: 4px;
}

.dw-saved-phone {
  font-size: 13px;
  color: var(--dw-text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.dw-edit-link {
  font-size: 12px;
  color: var(--dw-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}

.dw-edit-link:hover {
  color: var(--dw-primary-hover);
}

/* ==========================================================================
   In-Call Active Screen
   ========================================================================== */
.dw-call-screen {
  text-align: center;
  padding: 10px 0 10px;
}

/* Visualizer container */
.dw-visualizer-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ripple waves */
.dw-wave-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(79, 70, 229, 0.25);
  background: rgba(79, 70, 229, 0.04);
  transition: all 0.3s ease;
}

.dw-wave-ring-1 {
  width: 100%;
  height: 100%;
}

.dw-wave-ring-2 {
  width: 80%;
  height: 80%;
}

.dw-call-center-orb {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--dw-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 30px;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.45);
  z-index: 2;
  transition: transform 0.2s ease;
}

/* Pulsing effect when connected */
.dw-speaking .dw-wave-ring-1 {
  animation: dwWavePulse 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dw-speaking .dw-wave-ring-2 {
  animation: dwWavePulse 1.6s cubic-bezier(0.4, 0, 0.6, 1) 0.4s infinite;
}

.dw-speaking .dw-call-center-orb {
  transform: scale(1.06);
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.55);
}

@keyframes dwWavePulse {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.85);
    opacity: 0.8;
  }
}

/* Live Timer & Status */
.dw-call-timer {
  font-size: 24px;
  font-weight: 800;
  color: var(--dw-text-main);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.dw-call-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.dw-call-status-badge.dw-connecting {
  background: #fef3c7;
  color: #b45309;
}

.dw-call-status-badge.dw-connected {
  background: #d1fae5;
  color: #065f46;
}

.dw-call-status-badge.dw-ended,
.dw-call-status-badge.dw-failed {
  background: #fee2e2;
  color: #991b1b;
}

.dw-call-subtext {
  font-size: 13px;
  color: var(--dw-text-muted);
  max-width: 280px;
  margin: 0 auto 20px;
  line-height: 1.4;
  min-height: 20px;
}

/* Call Control Buttons */
.dw-call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}

.dw-hangup-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--dw-danger);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
  font-family: inherit;
}

.dw-hangup-btn:hover {
  background: var(--dw-danger-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

.dw-hangup-btn:active {
  transform: translateY(0);
}

.dw-call-again-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--dw-accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
  font-family: inherit;
}

.dw-call-again-btn:hover {
  transform: translateY(-2px);
}

/* Helpers */
.dw-d-none {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 576px) {
  .dw-launcher {
    bottom: 16px;
    right: 16px;
    padding: 6px 14px 6px 8px;
  }
  
  .dw-launcher-text {
    display: none;
  }

  .dw-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .dw-modal-card {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
}
