/* =============================================================
   VOICE DEMO MODAL - matches V2-Pre emerald palette
   ============================================================= */

.vd-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: vd-fade-in 0.3s ease;
}
.vd-modal[hidden] { display: none; }
@keyframes vd-fade-in { from { opacity: 0; } to { opacity: 1; } }

.vd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 23, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vd-dialog {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0,0,0,.3), 0 0 0 1px rgba(16,185,129,.1);
  max-width: 480px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 32px 28px;
  animation: vd-slide-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes vd-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.vd-close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--neutral-100, #f5f5f5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-500, #737373);
  transition: all .2s ease;
  z-index: 2;
}
.vd-close-btn:hover { background: var(--neutral-200, #e5e5e5); color: var(--neutral-900, #171717); }
.vd-close-btn svg { width: 18px; height: 18px; }

.vd-step { display: block; }
.vd-step[hidden] { display: none; }

/* === FORM STEP === */
.vd-form-head { text-align: center; margin-bottom: 24px; }
.vd-form-head .vd-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid rgba(16,185,129,.18);
  padding: 6px 14px;
  border-radius: 999px;
}
.vd-form-head .vd-eyebrow svg { width: 12px; height: 12px; color: #059669; }
.vd-form-head h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem; font-weight: 800;
  color: #171717; margin: 14px 0 8px;
  letter-spacing: -0.02em; line-height: 1.2;
}
.vd-form-head p {
  color: #525252; font-size: 14px; line-height: 1.5; margin: 0;
}

.vd-form { display: flex; flex-direction: column; gap: 14px; }
.vd-honeypot { position: absolute !important; left: -9999px; opacity: 0; pointer-events: none; }

.vd-field { display: flex; flex-direction: column; gap: 6px; }
.vd-label {
  font-family: 'Outfit', sans-serif; font-size: 12px; font-weight: 600;
  color: #404040; letter-spacing: 0.02em;
  display: flex; justify-content: space-between; align-items: center;
}
.vd-label em { font-style: normal; color: #ef4444; font-weight: 600; font-size: 11px; }
.vd-label .vd-optional { color: #a3a3a3; font-weight: 500; }

.vd-field input[type="tel"],
.vd-field input[type="email"],
.vd-field input[type="text"],
.vd-field select {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 11px 14px;
  background: #ffffff;
  border: 1.5px solid #e5e5e5;
  border-radius: 10px;
  color: #171717;
  width: 100%;
  transition: all .2s ease;
}
.vd-field input:focus, .vd-field select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.vd-field input.vd-invalid { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

.vd-error { color: #ef4444; font-size: 12px; min-height: 0; }
.vd-error:not(:empty) { min-height: 16px; padding-top: 2px; }

.vd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .vd-row { grid-template-columns: 1fr; } }

.vd-consent {
  display: flex; flex-direction: row; align-items: flex-start; gap: 10px;
  padding: 14px; background: #f5f5f5;
  border-radius: 10px; border: 1px solid #e5e5e5;
  cursor: pointer; user-select: none;
  margin-top: 4px;
}
.vd-consent input[type="checkbox"] {
  flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; cursor: pointer;
  accent-color: #10b981;
}
.vd-consent-text { font-size: 12px; line-height: 1.5; color: #525252; }
.vd-consent-text a { color: #059669; text-decoration: underline; }

.vd-submit {
  margin-top: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  background: #10b981; color: #ffffff;
  border: none; border-radius: 12px;
  font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(16,185,129,.3);
  transition: all .25s ease;
}
.vd-submit:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(16,185,129,.45);
}
.vd-submit:disabled { background: #d4d4d4; box-shadow: none; cursor: not-allowed; }
.vd-submit svg { width: 16px; height: 16px; transition: transform .25s ease; }
.vd-submit:hover:not(:disabled) svg { transform: translateX(3px); }
.vd-submit.vd-loading { background: #059669; cursor: wait; }
.vd-submit.vd-loading .vd-submit-label::after { content: ''; }

.vd-form-foot {
  text-align: center; font-size: 11px; color: #a3a3a3; margin: 4px 0 0;
}

/* === CALL STEP === */
.vd-step-call { text-align: center; padding: 8px 0; }

.vd-call-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px; margin-bottom: 24px;
  border-bottom: 1px solid #f5f5f5;
}
.vd-call-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #525252; }
.vd-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f59e0b; animation: vd-pulse-dot 1.5s ease infinite;
}
.vd-status-dot.vd-connected { background: #10b981; }
@keyframes vd-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.vd-call-timer {
  font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700;
  color: #10b981; letter-spacing: 0.05em;
}
.vd-call-timer.vd-warning { color: #f59e0b; }
.vd-call-timer.vd-critical { color: #ef4444; }

.vd-call-mic { display: flex; justify-content: center; padding: 24px 0; }
.vd-mic-pulse {
  width: 100px; height: 100px; border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex; align-items: center; justify-content: center;
  color: #ffffff; position: relative;
  box-shadow: 0 0 0 0 rgba(16,185,129,.6);
  animation: vd-pulse-mic 2s ease-out infinite;
}
.vd-mic-pulse svg { width: 44px; height: 44px; }
@keyframes vd-pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,.55), 0 8px 24px rgba(16,185,129,.3); }
  70% { box-shadow: 0 0 0 30px rgba(16,185,129,0), 0 8px 24px rgba(16,185,129,.3); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0), 0 8px 24px rgba(16,185,129,.3); }
}

.vd-call-persona { padding: 0 0 16px; }
.vd-call-persona h3 {
  font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 700;
  color: #171717; margin: 0 0 4px;
}
.vd-call-persona p { font-size: 13px; color: #737373; margin: 0; }

.vd-transcript {
  text-align: left;
  max-height: 180px; overflow-y: auto;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px; line-height: 1.55;
}
.vd-transcript-empty { color: #a3a3a3; text-align: center; padding: 16px 0; font-style: italic; }
.vd-transcript-line { margin-bottom: 8px; }
.vd-transcript-line strong { font-family: 'Outfit', sans-serif; font-weight: 700; }
.vd-transcript-line.vd-line-mia strong { color: #059669; }
.vd-transcript-line.vd-line-user strong { color: #525252; }

.vd-end-btn {
  width: 100%; padding: 13px 20px;
  background: #ef4444; color: #ffffff; border: none; border-radius: 10px;
  font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: background .2s ease;
}
.vd-end-btn:hover { background: #dc2626; }
.vd-end-btn svg { width: 16px; height: 16px; }

/* === SUCCESS STEP === */
.vd-step-done { text-align: center; padding: 16px 0; }
.vd-done-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: #ecfdf5; color: #10b981;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  animation: vd-pop 0.5s cubic-bezier(0.5, 1.5, 0.5, 1);
}
.vd-done-icon svg { width: 36px; height: 36px; }
@keyframes vd-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
.vd-step-done h2 {
  font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 800;
  color: #171717; margin: 0 0 8px;
}
.vd-step-done p { color: #525252; margin: 0 0 24px; font-size: 14px; }

.vd-done-list {
  list-style: none; padding: 0; margin: 0 0 28px;
  text-align: left;
  display: flex; flex-direction: column; gap: 12px;
}
.vd-done-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; line-height: 1.5; color: #404040;
}
.vd-done-list li svg {
  width: 18px; height: 18px; color: #10b981; flex-shrink: 0; margin-top: 2px;
}
.vd-done-list li strong { color: #171717; font-weight: 600; }

.vd-done-close {
  padding: 12px 28px;
  background: #f5f5f5; color: #404040;
  border: 1px solid #e5e5e5; border-radius: 10px;
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s ease;
}
.vd-done-close:hover { background: #e5e5e5; color: #171717; }

/* === ERROR STEP === */
.vd-step-error { text-align: center; padding: 16px 0; }
.vd-error-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: #fef2f2; color: #ef4444;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.vd-error-icon svg { width: 36px; height: 36px; }
.vd-step-error h2 {
  font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 800;
  color: #171717; margin: 0 0 8px;
}
.vd-step-error p { color: #737373; margin: 0 0 24px; font-size: 14px; }

/* === MOBILE === */
@media (max-width: 540px) {
  .vd-dialog { padding: 24px 20px; max-height: 95vh; border-radius: 16px; }
  .vd-form-head h2 { font-size: 1.25rem; }
  .vd-mic-pulse { width: 88px; height: 88px; }
  .vd-mic-pulse svg { width: 36px; height: 36px; }
  .vd-call-timer { font-size: 18px; }
}

/* === LOCK BODY SCROLL when modal open === */
body.vd-modal-open { overflow: hidden; }

/* ============================================================
   BASH 1530 - Modal scroll fix + mobile optimization (CLEAN)
   Strategy: scroll INSIDE the step container, not the dialog itself
   This keeps the dialog's rounded corners and edges clean
   ============================================================ */

/* Dialog stays a fixed clean shape - NO scroll on this element */
.vd-dialog {
  max-height: 88vh;
  overflow: hidden;       /* CRITICAL - prevents scrollbar on the dialog frame */
  display: flex;
  flex-direction: column;
}

/* The step inside scrolls if needed - scrollbar lives INSIDE */
.vd-step {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  /* Hide scrollbar on Firefox if content fits */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

/* Webkit scrollbar styling (Chrome/Safari) - subtle, thin, only when needed */
.vd-step::-webkit-scrollbar {
  width: 6px;
}
.vd-step::-webkit-scrollbar-track {
  background: transparent;
}
.vd-step::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}
.vd-step::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.2);
}

/* Tighten form padding to reduce need for scrolling */
.vd-step.vd-step-form {
  padding: 24px 28px 24px;
}

/* Reduce form gap so it fits nicer */
.vd-form > * + * {
  margin-top: 14px;
}

/* Form heading - more compact */
.vd-form-head {
  margin-bottom: 18px;
}

.vd-form-head h2 {
  font-size: 22px;
  margin: 8px 0 6px;
  line-height: 1.2;
}

.vd-form-head p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--neutral-600, #525252);
  margin: 0;
}

/* Consent blocks - clean compact */
.vd-consent {
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.45;
  background: var(--neutral-50, #fafafa);
  border: 1px solid var(--neutral-200);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.vd-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--brand-500, #10b981);
  margin-top: 1px;
  cursor: pointer;
}

.vd-consent-text {
  color: var(--neutral-700, #404040);
  flex: 1;
}

.vd-consent-text strong {
  font-weight: 600;
  color: var(--neutral-900, #171717);
}

.vd-consent-text a {
  color: var(--brand-600, #059669);
  text-decoration: underline;
}

.vd-consent-text a:hover {
  color: var(--brand-700, #047857);
}

/* ============================================================
   MOBILE - 600px and below: full-screen native sheet
   ============================================================ */
@media (max-width: 600px) {

  .vd-modal {
    align-items: stretch;
    padding: 0;
  }

  .vd-dialog {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .vd-step.vd-step-form {
    padding: 20px 18px 24px;
  }

  /* Bigger close button - better tap target */
  .vd-close-btn {
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
  }

  .vd-close-btn svg {
    width: 22px;
    height: 22px;
  }

  /* Form heading takes less space */
  .vd-form-head {
    margin-bottom: 18px;
    padding-right: 40px; /* leave room for close button */
  }

  /* Form fields stack on mobile */
  .vd-row {
    flex-direction: column;
    gap: 14px;
  }

  .vd-field-half {
    width: 100%;
  }

  /* Larger input fields - 16px prevents iOS zoom on focus */
  .vd-field input[type="tel"],
  .vd-field input[type="email"],
  .vd-field input[type="text"],
  .vd-field select {
    font-size: 16px !important;
    padding: 12px 14px;
    min-height: 44px;
  }

  .vd-label {
    font-size: 13px;
  }

  /* Consent boxes - bigger checkboxes for thumbs */
  .vd-consent {
    padding: 12px;
    gap: 11px;
  }

  .vd-consent input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 0;
  }

  /* Submit button - sticky at bottom of viewport for safe-area phones */
  .vd-submit {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    margin-top: 18px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 5;
    background-clip: padding-box;
  }

  .vd-form-foot {
    font-size: 11px;
    margin-top: 12px;
  }

  /* Call screen on mobile */
  .vd-step-call {
    padding: 24px 18px;
  }

  .vd-call-mic {
    margin: 24px 0;
  }

  /* End call button stays accessible */
  .vd-end-btn {
    position: sticky;
    bottom: 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Very small phones (under 380px) */
@media (max-width: 380px) {
  .vd-step.vd-step-form { padding: 16px 14px 22px; }
  .vd-form-head h2 { font-size: 20px; }
  .vd-consent { font-size: 11.5px; padding: 10px; }
}
