/*
 * PrimeInvestor — Schedule a Call popup (HTML/CSS/JS rebuild)
 *
 * Vanilla replacement for the React (Vite) popup at /assets/popupSch/.
 * Everything is scoped under `.psh-root` to avoid colliding with theme styles.
 * Colours and sizing match the existing React popup (primary #012E40).
 */

/* ---------- Reset (scoped) ---------- */
.psh-root,
.psh-root *,
.psh-root *::before,
.psh-root *::after {
  box-sizing: border-box;
}

.psh-root {
  /* Primary (CTA buttons) — matches React `--primary:#012e40`. */
  --psh-primary: #012e40;
  --psh-primary-2: #023a52;
  --psh-primary-3: #054a66;
  /* Hero gradient — matches React `bg-gradient-to-br from-blue-900 to-blue-800`. */
  --psh-hero-from: #1e3a8a; /* tailwind blue-900 */
  --psh-hero-to:   #1e40af; /* tailwind blue-800 */
  --psh-blue-50:   #eff6ff;
  --psh-blue-100:  #dbeafe;
  --psh-blue-200:  #bfdbfe;
  --psh-blue-300:  #93c5fd;
  --psh-blue-800:  #1e40af;
  --psh-blue-900:  #1e3a8a;
  --psh-bg: #ffffff;
  --psh-fg: #0b1e26;
  --psh-muted: #6b7280;
  --psh-muted-2: #9ca3af;
  --psh-border: #e5e7eb;
  --psh-input-bg: #f4f5f7;
  /* Match legacy Tailwind red-500 used in the React popup. */
  --psh-error: oklch(63.7% 0.237 25.331);
  --psh-success: #16a34a;
  --psh-warn: #b45309;
  --psh-radius: 0.75rem;
  --psh-radius-sm: 0.5rem;
  --psh-radius-lg: 1rem;
  --psh-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45);

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  /* Match site typography (existing popup uses Rubik 400/600). */
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--psh-fg);
}

.psh-root.psh-open {
  display: block;
}

.psh-root .psh-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 22, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: psh-fade-in 0.2s ease-out;
}

.psh-root .psh-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 24px));
  background: var(--psh-bg);
  border-radius: var(--psh-radius-lg);
  box-shadow: var(--psh-shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  animation: psh-pop-in 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (max-width: 1023px) {
  .psh-root .psh-modal {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 16px);
    width: calc(100vw - 16px);
    border-radius: var(--psh-radius);
    /* Let the whole modal scroll vertically on mobile (hero + body as one
       continuous column) — matches the React popup behaviour. */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile: after "Get Started →", hide the marketing hero and show only the form (matches React). */
@media (max-width: 1023px) {
  .psh-root.psh-mobile-form-only .psh-hero {
    display: none;
  }
  .psh-root.psh-mobile-form-only .psh-body {
    padding-top: 22px;
  }
}

/* ---------- Hero (left, brand) ---------- */
.psh-root .psh-hero {
  /* React: bg-gradient-to-br from-blue-900 to-blue-800 (top-left → bottom-right). */
  background: linear-gradient(135deg, var(--psh-hero-from) 0%, var(--psh-hero-to) 100%);
  color: #ffffff;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.psh-root .psh-hero h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  color: #ffffff;
}

.psh-root .psh-hero h2 small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--psh-blue-100);
  margin-top: 6px;
}

.psh-root .psh-feature {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.psh-root .psh-feature svg {
  flex: 0 0 18px;
  margin-top: 2px;
  color: #4ade80; /* tailwind green-400 */
}

.psh-root .psh-feature h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px;
  color: #ffffff;
}

.psh-root .psh-feature p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--psh-blue-100);
}

.psh-root .psh-expect {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: var(--psh-radius);
  padding: 14px 16px;
  margin-top: auto;
}

.psh-root .psh-expect h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.psh-root .psh-expect ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.psh-root .psh-expect li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--psh-blue-50);
}

.psh-root .psh-expect li::before {
  content: "•";
  color: var(--psh-blue-300);
  font-weight: 700;
}

@media (max-width: 1023px) {
  .psh-root .psh-hero {
    padding: 20px 18px 18px;
    gap: 14px;
    /* Defer scrolling to the modal so hero+body scroll together. */
    overflow: visible;
  }
  .psh-root .psh-hero h2 {
    font-size: 20px;
  }
  /* Keep the "What to Expect" block flush against the features above
     instead of pushed to the bottom (margin-top:auto only makes sense
     when the hero is its own scroll column on desktop). */
  .psh-root .psh-hero .psh-expect {
    margin-top: 4px;
  }
}

/* ---------- Body (right, form) ---------- */
.psh-root .psh-body {
  /* Close button should be anchored to the modal, not the body column. */
  position: static;
  padding: 24px 28px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Centre the right-panel content vertically when it's shorter than the modal
   (step 0 / success). Longer steps push beyond and scroll naturally. */
.psh-root .psh-body .psh-content {
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
}

@media (max-width: 1023px) {
  .psh-root .psh-body {
    padding: 18px 18px 22px;
    /* Let the modal own the scroll on mobile. */
    overflow: visible;
  }
  .psh-root .psh-body .psh-content {
    margin-top: 0;
    margin-bottom: 0;
  }
}

.psh-root .psh-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: #f3f4f6;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4b5563;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  z-index: 2;
  padding: 0;
  line-height: 1;
}

.psh-root .psh-close:hover {
  background: #e5e7eb;
  color: var(--psh-fg);
  transform: scale(1.05);
}

.psh-root .psh-close:focus-visible {
  outline: 2px solid var(--psh-primary);
  outline-offset: 2px;
}

/* CSS-drawn X — robust against theme SVG overrides. */
.psh-root .psh-close svg { display: none !important; }

.psh-root .psh-close::before,
.psh-root .psh-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
}

.psh-root .psh-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.psh-root .psh-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.psh-root .psh-step-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--psh-fg);
  margin: 0 0 4px;
}

.psh-root .psh-step-sub {
  font-size: 13px;
  color: var(--psh-muted);
  margin: 0 0 18px;
}

/* ---------- Form fields ---------- */
.psh-root .psh-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.psh-root .psh-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--psh-fg);
}

.psh-root .psh-label .psh-req {
  color: var(--psh-error);
  margin-left: 2px;
}

.psh-root .psh-input,
.psh-root .psh-select,
.psh-root .psh-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--psh-fg);
  background: #ffffff;
  border: 1px solid var(--psh-border);
  border-radius: var(--psh-radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  height: 42px;
}

.psh-root .psh-textarea {
  height: auto;
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.psh-root .psh-input:focus,
.psh-root .psh-select:focus,
.psh-root .psh-textarea:focus {
  border-color: var(--psh-primary);
  box-shadow: 0 0 0 3px rgba(1, 46, 64, 0.12);
}

.psh-root .psh-input.psh-invalid,
.psh-root .psh-select.psh-invalid,
.psh-root .psh-textarea.psh-invalid {
  border-color: var(--psh-error);
}

.psh-root .psh-mobile {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
}

.psh-root .psh-mobile .psh-input {
  height: 42px;
}

.psh-root .psh-mobile-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--psh-input-bg);
  border: 1px solid var(--psh-border);
  border-radius: var(--psh-radius-sm);
  font-size: 14px;
  color: var(--psh-fg);
  font-weight: 500;
}

.psh-root .psh-error-msg {
  font-size: 12px;
  color: var(--psh-error);
  margin: 0;
}

.psh-root .psh-warn-msg {
  font-size: 12px;
  color: var(--psh-warn);
  margin: 0;
}

/* Eligibility: below-min investable assets decision card (matches React). */
.psh-root .psh-assets-gate {
  margin: 12px 0 0;
  border: 1px solid #fde68a; /* amber-200 */
  background: #fffbeb;       /* amber-50 */
  border-radius: var(--psh-radius-sm);
  padding: 12px;
  display: none; /* shown only for < ₹50 lakh */
}

.psh-root .psh-assets-gate-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #92400e; /* amber-800 */
  font-weight: 500;
  font-size: 13px;
  margin: 0 0 10px;
}

.psh-root .psh-assets-gate-actions {
  display: flex;
  gap: 10px;
}

.psh-root .psh-assets-gate-explore,
.psh-root .psh-assets-gate-continue {
  flex: 1;
  height: 40px;
  border-radius: var(--psh-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.psh-root .psh-assets-gate-explore {
  border: 0;
  background: #d97706; /* amber-600 */
  color: #ffffff;
}

.psh-root .psh-assets-gate-explore:hover {
  filter: brightness(1.05);
}

.psh-root .psh-assets-gate-continue {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: var(--psh-primary);
}

.psh-root .psh-assets-gate-continue:hover {
  background: #f9fafb;
}

.psh-root .psh-help {
  font-size: 12px;
  color: var(--psh-muted);
  margin: 0;
}

/* Radio cards (current management) — side-by-side 2x2 grid like the React popup. */
.psh-root .psh-radios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 480px) {
  .psh-root .psh-radios {
    grid-template-columns: 1fr;
  }
}

.psh-root .psh-radio {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--psh-border);
  border-radius: var(--psh-radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
}

.psh-root .psh-radio:hover {
  background: #f9fafb;
}

.psh-root .psh-radio input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--psh-muted-2);
  border-radius: 999px;
  position: relative;
  flex: 0 0 16px;
  cursor: pointer;
}

.psh-root .psh-radio input:checked {
  border-color: var(--psh-primary);
}

.psh-root .psh-radio input:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--psh-primary);
  border-radius: 999px;
}

.psh-root .psh-radio input:checked + span {
  font-weight: 600;
}

.psh-root .psh-radio span {
  font-size: 14px;
  color: var(--psh-fg);
}

/* Buttons */
.psh-root .psh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 0 18px;
  height: 46px;
  border-radius: var(--psh-radius-sm);
  border: 0;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s, background 0.15s;
  width: 100%;
  background: var(--psh-primary);
  color: #ffffff;
}

.psh-root .psh-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.psh-root .psh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile step-0 intro: bright CTA like the React popup (before OTP form). */
.psh-root .psh-btn-mobile-cta {
  margin-top: 8px;
  background: #2563eb;
  height: 48px;
  font-size: 16px;
}

.psh-root .psh-btn-mobile-cta:hover:not(:disabled) {
  filter: brightness(1.08);
}

.psh-root .psh-mobile-intro-foot {
  text-align: center;
  font-size: 12px;
  color: var(--psh-muted);
  margin: 14px 0 0;
}

/* Visually hidden heading for dialog aria-labelledby on mobile intro. */
.psh-root .psh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.psh-root .psh-btn-ghost {
  background: transparent;
  color: var(--psh-primary);
  border: 1px solid var(--psh-border);
}

.psh-root .psh-btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  filter: none;
}

.psh-root .psh-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.psh-root .psh-btn-row .psh-btn {
  flex: 1;
}

.psh-root .psh-toggle-line {
  text-align: center;
  font-size: 13px;
  color: var(--psh-muted);
  margin-top: 14px;
}

.psh-root .psh-toggle-line button {
  border: 0;
  background: transparent;
  /* Match the site-wide `.pms-login` colour used by the React popup. */
  color: #00a3d9;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.psh-root .psh-toggle-line button:hover {
  color: #00a3d9;
  text-decoration: underline;
}

.psh-root .psh-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: psh-spin 0.7s linear infinite;
}

.psh-root .psh-btn-ghost .psh-spinner {
  border-color: rgba(1, 46, 64, 0.25);
  border-top-color: var(--psh-primary);
}

/* OTP boxes */
.psh-root .psh-otp-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.psh-root .psh-otp-row input {
  flex: 1;
  height: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  border: 1px solid var(--psh-border);
  border-radius: var(--psh-radius-sm);
  background: #ffffff;
  outline: none;
  font-family: inherit;
}

.psh-root .psh-otp-row input:focus {
  border-color: var(--psh-primary);
  box-shadow: 0 0 0 3px rgba(1, 46, 64, 0.12);
}

.psh-root .psh-otp-meta {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--psh-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.psh-root .psh-otp-meta button {
  background: transparent;
  border: 0;
  color: var(--psh-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 12.5px;
  padding: 0;
}

.psh-root .psh-otp-meta button:disabled {
  color: var(--psh-muted-2);
  cursor: not-allowed;
}

/* Inline OTP slide-down (Step 0): collapsed by default, expands smoothly when OTP is sent. */
.psh-root .psh-otp-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transform: translateY(-4px);
  visibility: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.3s ease,
    transform 0.3s ease,
    margin-top 0.3s ease,
    visibility 0s linear 0.4s;
}

.psh-root .psh-otp-section.psh-otp-expanded {
  max-height: 360px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 4px;
  visibility: visible;
  transition:
    max-height 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.3s ease,
    transform 0.3s ease,
    margin-top 0.3s ease,
    visibility 0s linear 0s;
}

.psh-root .psh-otp-input {
  letter-spacing: 6px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* Locked-input label row + Change link (used after OTP is sent). */
.psh-root .psh-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.psh-root .psh-change-link {
  background: transparent;
  border: 0;
  color: var(--psh-primary);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
}

.psh-root .psh-change-link:hover {
  text-decoration: underline;
}

.psh-root .psh-input[readonly] {
  background: var(--psh-input-bg);
  color: var(--psh-fg);
  cursor: default;
}

.psh-root .psh-mobile .psh-input[readonly] {
  background: var(--psh-input-bg);
}

/* Consent card on Step 4 (Additional Information) — matches React `bg-blue-50 border-2 border-blue-200`. */
.psh-root .psh-consent-card {
  background: var(--psh-blue-50);
  border: 2px solid var(--psh-blue-200);
  border-radius: var(--psh-radius);
  padding: 20px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.psh-root .psh-consent-card .psh-consent-text {
  font-size: 12px;
  color: var(--psh-muted);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

.psh-root .psh-consent-card .psh-consent-secure {
  font-size: 12px;
  color: var(--psh-muted);
  text-align: center;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.psh-root .psh-presentation-line {
  text-align: center;
  font-size: 14px;
  color: var(--psh-muted);
  margin: 14px 0 0;
}

.psh-root .psh-presentation-line a {
  color: var(--psh-primary);
  font-weight: 600;
  text-decoration: none;
}

.psh-root .psh-presentation-line a:hover {
  text-decoration: underline;
}

/* Success screen */
.psh-root .psh-success {
  text-align: center;
  padding: 24px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.psh-root .psh-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #dcfce7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  margin-bottom: 12px;
}

.psh-root .psh-success h3 {
  font-size: 22px;
  margin: 4px 0 6px;
  color: #166534;
  font-weight: 600;
}

.psh-root .psh-success p {
  margin: 0 0 16px;
  color: var(--psh-muted);
  font-size: 14px;
}

.psh-root .psh-next-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--psh-radius);
  padding: 16px 18px;
  text-align: left;
  width: 100%;
  margin-bottom: 18px;
}

.psh-root .psh-next-card h4 {
  margin: 0 0 10px;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 600;
}

.psh-root .psh-next-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #1e40af;
  font-size: 13px;
}

.psh-root .psh-next-card li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.psh-root .psh-next-card li svg {
  flex: 0 0 16px;
  margin-top: 2px;
  color: #2563eb;
}

/* Animations */
@keyframes psh-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes psh-pop-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes psh-spin {
  to { transform: rotate(360deg); }
}

/* Hide the legacy React mount when our HTML popup is active. */
.psh-html-active .pms-schedule-call-root,
.psh-html-active .pms-schedule-call-popup {
  display: none !important;
}
