/* ============================================================================
   Popup Contact Form — orto-toolkit
   Timed modal with CF7 form. Styled after doc-cta section.
   Tokens: --color-accent #ff3a2d, --color-dark #0b1220, Inter
   ========================================================================= */

/* ── Keyframes ──────────────────────────────────────────────────────────────── */

@keyframes opf-enter {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */

.opf-overlay {
  position: fixed;
  inset: 0;
  z-index: 99995;
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.opf-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.opf-overlay.is-open .opf-modal {
  animation: opf-enter 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Modal card ──────────────────────────────────────────────────────────── */

.opf-modal {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 32px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ── Close button ────────────────────────────────────────────────────────── */

.opf-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(11, 18, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.opf-close:hover,
.opf-close:focus-visible {
  background: #ff3a2d;
  color: #ffffff;
  transform: scale(1.08);
  outline: none;
}

/* ── Left: form body ─────────────────────────────────────────────────────── */

.opf-body {
  flex: 1 1 0;
  min-width: 0;
  background: #ffffff;
  padding: 36px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Badge */
.opf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 58, 45, 0.08);
  color: #ff3a2d;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 20px;
  align-self: flex-start;
}

/* Heading */
.opf-heading {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: clamp(22px, 3.5vw, 28px);
  font-weight: 900;
  color: #0b1220;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 0;
}

/* Subtext */
.opf-subtext {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

/* ── CF7 form overrides ──────────────────────────────────────────────────── */

.opf-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hide CF7 default "Required fields" message */
.opf-form-wrap .wpcf7-form > p:first-child {
  display: none;
}

/* All form controls full-width */
.opf-form-wrap .wpcf7-form-control-wrap {
  display: block;
  width: 100%;
}

/* Text + tel inputs */
.opf-form-wrap input[type="text"],
.opf-form-wrap input[type="tel"],
.opf-form-wrap input[type="email"] {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 500;
  color: #0b1220;
  box-sizing: border-box;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
}

.opf-form-wrap input[type="text"]:focus,
.opf-form-wrap input[type="tel"]:focus,
.opf-form-wrap input[type="email"]:focus {
  outline: none;
  border-color: #ff3a2d;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 58, 45, 0.12);
}

.opf-form-wrap input[type="text"]::placeholder,
.opf-form-wrap input[type="tel"]::placeholder,
.opf-form-wrap input[type="email"]::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* Validation error state */
.opf-form-wrap .wpcf7-not-valid {
  border-color: #ff3a2d !important;
  background: #fff7f7 !important;
}

.opf-form-wrap .wpcf7-not-valid-tip {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 11px;
  color: #ff3a2d;
  margin-top: 4px;
  display: block;
}

/* Submit button */
.opf-form-wrap input[type="submit"],
.opf-form-wrap .wpcf7-submit {
  width: 100%;
  height: 52px;
  background: #ff3a2d;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.opf-form-wrap input[type="submit"]:hover,
.opf-form-wrap .wpcf7-submit:hover {
  background: #e02e22;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 58, 45, 0.35);
}

.opf-form-wrap input[type="submit"]:active,
.opf-form-wrap .wpcf7-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

/* CF7 spinner */
.opf-form-wrap .wpcf7-spinner {
  display: none;
}

/* CF7 success / failure messages */
.opf-form-wrap .wpcf7-response-output {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 10px;
  border: none !important;
  margin: 0 !important;
}

.opf-form-wrap .wpcf7-mail-sent-ok {
  background: #f0fdf4;
  color: #166534;
}

.opf-form-wrap .wpcf7-mail-sent-ng,
.opf-form-wrap .wpcf7-validation-errors,
.opf-form-wrap .wpcf7-spam-blocked {
  background: #fff7f7;
  color: #991b1b;
}

/* ── Trust list ──────────────────────────────────────────────────────────── */

.opf-trust {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.opf-trust li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
}

.opf-trust li svg {
  flex-shrink: 0;
  stroke: #22c55e;
}

/* ── Right: doctor photo ─────────────────────────────────────────────────── */

.opf-media {
  flex: 0 0 240px;
  position: relative;
  background: #0b1220;
  overflow: hidden;
}

.opf-media__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Gradient overlay to ensure text legibility at bottom */
.opf-media__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 35%, rgba(11, 18, 32, 0.82) 100%);
}

/* Doctor badge at bottom of photo column */
.opf-media__doctor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.opf-media__doctor-icon {
  color: #ff3a2d;
  flex-shrink: 0;
  margin-top: 2px;
}

.opf-media__doctor-name {
  display: block;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.opf-media__doctor-prefix {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.03em;
  margin-bottom: 1px;
}

.opf-media__doctor-title {
  margin: 4px 0 0;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
}

/* ── Thank-you state (JS adds .opf-modal--sent) ──────────────────────────── */

.opf-modal--sent .opf-body {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}

.opf-thankyou {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.opf-thankyou__icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
}

.opf-thankyou__heading {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 22px;
  font-weight: 900;
  color: #0b1220;
  margin: 0;
}

.opf-thankyou__text {
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 14px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
  max-width: 280px;
}

.opf-thankyou__close {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: #ff3a2d;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.opf-thankyou__close:hover {
  background: #e02e22;
  transform: translateY(-1px);
}

/* ── Mobile (≤ 600px) ────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  /* Full-screen overlay, no padding — sheet slides up from bottom */
  .opf-overlay {
    padding: 0;
    align-items: flex-end;
  }

  /* Bottom sheet: full width, capped height, rounded top corners only */
  .opf-modal {
    width: 100%;
    max-width: 100%;
    max-height: 90dvh; /* dvh avoids mobile browser chrome overlap */
    height: auto;
    border-radius: 20px 20px 0 0;
    flex-direction: column;
    overflow: hidden;
  }

  /* Doctor photo hidden — not needed on mobile */
  .opf-media {
    display: none;
  }

  /* Body scrolls internally so nothing overflows off screen */
  .opf-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 20px 36px;
    gap: 12px;
  }

  .opf-badge {
    font-size: 10px;
    padding: 4px 10px;
  }

  .opf-heading {
    font-size: 20px;
    letter-spacing: -0.3px;
  }

  .opf-subtext {
    font-size: 13px;
  }

  /* Inputs and submit full-height touch targets */
  .opf-form-wrap input[type="text"],
  .opf-form-wrap input[type="tel"],
  .opf-form-wrap input[type="email"] {
    height: 48px;
    font-size: 16px; /* prevents iOS auto-zoom on focus */
  }

  .opf-form-wrap input[type="submit"],
  .opf-form-wrap .wpcf7-submit {
    height: 52px;
    font-size: 16px;
  }

  /* Trust list smaller on mobile */
  .opf-trust li {
    font-size: 11px;
  }

  /* Thank-you screen on mobile */
  .opf-thankyou__heading {
    font-size: 20px;
  }

  .opf-thankyou__close {
    width: 100%;
    justify-content: center;
  }
}
