/* ========================================
   Vapi Voice Agent UI Styles
   ======================================== */

/* --- Voice UI Container --- */
.vapi-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

/* --- Pre-Call State --- */
.vapi-pre-call {
  text-align: center;
  padding: 40px 20px;
}

.vapi-pre-call-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 20px;
  box-shadow: 0 4px 20px rgba(26, 115, 232, 0.3);
  border: 3px solid var(--primary);
}

.vapi-pre-call h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.vapi-pre-call p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 24px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.vapi-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
  min-height: 56px;
}

.vapi-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

.vapi-start-btn:active {
  transform: translateY(0);
}

.vapi-start-btn:disabled {
  background: #94b8e0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Skip-to-Photos Button (Attach Error Photo) --- */
.vapi-skip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 12px;
  min-height: 48px;
}

.vapi-skip-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.25);
}

.vapi-skip-btn:active {
  transform: translateY(0);
}

/* --- Active Call State --- */
.vapi-active-call {
  text-align: center;
  padding: 20px;
  width: 100%;
}

.vapi-avatar-container {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
  position: relative;
  box-shadow: 0 4px 20px rgba(26, 115, 232, 0.3);
}

.vapi-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

/* Speaking animation ring */
.vapi-avatar-container.speaking::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: vapi-pulse 1.5s ease-in-out infinite;
}

@keyframes vapi-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.2;
  }
}

.vapi-status {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 16px;
  min-height: 24px;
}

.vapi-status.connecting {
  color: var(--warning);
}

.vapi-status.active {
  color: var(--success);
}

/* --- Live Transcript --- */
.vapi-transcript {
  background: #f8f9fa;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  max-height: 150px;
  overflow-y: auto;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 80px;
}

.vapi-transcript-empty {
  color: var(--text-light);
  font-style: italic;
  text-align: center;
}

.vapi-transcript-line {
  margin-bottom: 8px;
}

.vapi-transcript-line:last-child {
  margin-bottom: 0;
}

.vapi-transcript-speaker {
  font-weight: 600;
  color: var(--primary);
}

.vapi-transcript-speaker.user {
  color: var(--success);
}

/* --- Call Controls --- */
.vapi-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.vapi-control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vapi-control-btn.mute {
  background: #f5f5f5;
  color: var(--text);
}

.vapi-control-btn.mute:hover {
  background: #e0e0e0;
}

.vapi-control-btn.mute.muted {
  background: var(--warning);
  color: white;
}

.vapi-control-btn.end {
  background: var(--error);
  color: white;
}

.vapi-control-btn.end:hover {
  background: #b71c1c;
}

/* --- Post-Call State --- */
.vapi-post-call {
  padding: 20px;
}

.vapi-post-call h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vapi-post-call h3::before {
  content: '\2713';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 0.8rem;
}

/* --- Summary Content --- */
.vapi-summary {
  background: #f8f9fa;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.vapi-summary-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.vapi-summary-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.vapi-summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.vapi-summary-value {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.vapi-summary-value.empty {
  color: var(--text-light);
  font-style: italic;
}

/* --- Post-Call Buttons --- */
.vapi-post-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vapi-post-buttons .btn {
  width: 100%;
}

/* --- Error / Fallback State --- */
.vapi-error {
  text-align: center;
  padding: 30px 20px;
}

.vapi-error-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff3e0;
  color: var(--warning);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.vapi-error h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.vapi-error p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* --- Text Form Fallback (shown on error/unsupported) --- */
.vapi-text-fallback {
  display: none;
}

.vapi-text-fallback.visible {
  display: block;
}

/* --- Loading State --- */
.vapi-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.vapi-loading .spinner {
  display: block;
  width: 48px;
  height: 48px;
}

.vapi-loading-text {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* --- Volume Indicator --- */
.vapi-volume {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 30px;
  margin-bottom: 12px;
}

.vapi-volume-bar {
  width: 4px;
  height: 8px;
  background: var(--border);
  border-radius: 2px;
  transition:
    height 0.1s ease,
    background 0.1s ease;
}

.vapi-volume-bar.active {
  background: var(--primary);
}

/* --- Mobile Optimizations --- */
@media (max-width: 480px) {
  .vapi-pre-call {
    padding: 30px 16px;
  }

  .vapi-pre-call-icon {
    width: 80px;
    height: 80px;
  }

  .vapi-avatar-container {
    width: 100px;
    height: 100px;
  }

  .vapi-start-btn,
  .vapi-skip-btn {
    width: 100%;
    max-width: 280px;
  }

  .vapi-transcript {
    max-height: 120px;
  }
}

/* --- Keep Screen Active Warning --- */
.vapi-screen-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff3e0;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--warning);
  margin-top: 16px;
}

.vapi-screen-warning-icon {
  flex-shrink: 0;
}
