/* Roots Daily — payment.css
 * Multi-step payment modal (Razorpay).
 * Only used when RD_CONFIG.PAYMENT_ENABLED === true.
 * Loaded on every page; modal is injected on first open.
 */

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pay-modal.open {
  display: flex;
  animation: payFade 0.2s ease;
}

.pay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 25, 54, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.pay-modal-card {
  position: relative;
  background: white;
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(16, 25, 54, 0.3);
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 36px 28px 28px;
  animation: payRise 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 640px) {
  .pay-modal-card {
    padding: 40px 36px 32px;
  }
}

.pay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--navy);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s ease;
}

.pay-close:hover {
  background: var(--teal-soft);
}

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

.pay-step h2 {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--navy);
}

.pay-step h2 em {
  font-style: italic;
  color: var(--teal);
}

.pay-step .pay-sub {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.55;
}

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

.pay-field label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  padding-left: 4px;
}

.pay-field input {
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.pay-field input::placeholder {
  color: rgba(82, 87, 117, 0.45);
}

.pay-field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(196, 109, 125, 0.14);
}

.pay-field.invalid input {
  border-color: #d94668;
  box-shadow: 0 0 0 4px rgba(217, 70, 104, 0.12);
}

.pay-field .pay-error {
  font-size: 12px;
  color: #b53a52;
  padding-left: 6px;
  display: none;
  font-weight: 600;
  margin-top: 2px;
}

.pay-field.invalid .pay-error {
  display: block;
}

.pay-field .pay-hint {
  font-size: 12px;
  color: var(--muted);
  padding-left: 6px;
  margin-top: 2px;
}

/* ===== Price notice (shown when plan picker is hidden) ===== */
.pay-amount-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 20px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(196, 109, 125, 0.08), rgba(196, 109, 125, 0.02));
  border: 1px solid rgba(196, 109, 125, 0.18);
  border-radius: 16px;
}

.pay-amount-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}

.pay-amount-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.pay-amount-value small {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 4px;
}

/* ===== Plan picker (radios) ===== */
.pay-plans {
  border: 0;
  padding: 0;
  margin: 18px 0 20px;
  display: grid;
  gap: 10px;
}

.pay-plans legend {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  padding-left: 4px;
  margin-bottom: 6px;
}

.pay-plan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.pay-plan:hover {
  border-color: var(--teal);
}

.pay-plan input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
}

.pay-plan-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.pay-plan-text strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.pay-plan-text span {
  font-size: 13px;
  color: var(--muted);
}

.pay-plan-price {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.03em;
}

.pay-plan input[type="radio"]:checked ~ * {
  /* visual treatment via :has on parent */
}

.pay-plan:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.pay-plan:has(input:checked) .pay-plan-price {
  color: var(--teal);
}

/* ===== Confirm review ===== */
.pay-review {
  margin: 18px 0 22px;
  display: grid;
  gap: 1px;
  background: var(--line);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.pay-review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: white;
  font-size: 14px;
}

.pay-review-row > span {
  color: var(--muted);
  font-weight: 600;
}

.pay-review-row > strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  word-break: break-word;
}

.pay-review-row.pay-total {
  background: var(--paper);
}

.pay-review-row.pay-total > strong {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--navy);
  letter-spacing: -0.03em;
}

/* ===== Action buttons ===== */
.pay-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.pay-actions .btn {
  flex: 1 1 0;
  min-height: 50px;
  padding: 13px 16px;
}

.pay-step .btn.primary {
  width: 100%;
  min-height: 52px;
}

.pay-step .btn.primary[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== Success screen ===== */
.pay-success {
  text-align: center;
  padding: 6px 0 0;
}

.pay-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}

.pay-success h2 {
  text-align: center;
  margin-bottom: 14px;
}

.pay-success p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px;
}

.pay-receipt-id {
  display: inline-block;
  background: var(--paper);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
  word-break: break-all;
}

.pay-receipt-id code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  font-weight: 700;
}

/* ===== Failure / error banner ===== */
.pay-error-banner {
  background: #fef0ef;
  color: #b53a52;
  border: 1px solid #f4c5c1;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 14px;
  display: none;
}

.pay-error-banner.show {
  display: block;
}

/* ===== Animations ===== */
@keyframes payFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes payRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Lock body scroll when modal is open */
body.pay-modal-open {
  overflow: hidden;
}

/* ===== intl-tel-input integration =====
 * Themed via the library's CSS variables where possible, with targeted
 * overrides for layout (wrapper width, rounded corners, divider, focus).
 * The country dropdown is rendered at <body> via dropdownContainer, so its
 * z-index is bumped above the modal (z=1000) below.
 *
 * IMPORTANT: never set `padding` (shorthand) on .iti__tel-input — the
 * library sets `padding-left` inline at runtime to make room for the flag
 * dropdown. Only set the other three sides here.
 */

/* Theme — variable overrides match the site palette */
.pay-field-tel .iti {
  --iti-hover-color: rgba(196, 109, 125, 0.08);
  --iti-border-color: var(--line);
  --iti-dialcode-color: var(--ink);
  --iti-spacer-horizontal: 12px;
  --iti-arrow-padding: 8px;
  display: block;
  width: 100%;
}

/* Phone input — looks like the rest of our form fields. */
.pay-field-tel .iti input.iti__tel-input,
.pay-field-tel .iti input.iti__tel-input[type="text"],
.pay-field-tel .iti input.iti__tel-input[type="tel"] {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding-top: 13px;
  padding-right: 16px;
  padding-bottom: 13px;
  /* padding-left is set inline by the library — do not override */
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.pay-field-tel .iti input.iti__tel-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(196, 109, 125, 0.14);
}

.pay-field-tel.invalid .iti input.iti__tel-input {
  border-color: #d94668;
  box-shadow: 0 0 0 4px rgba(217, 70, 104, 0.12);
}

/* Country selector — rounded on the left, subtle vertical divider that
 * picks up the teal accent when the input is focused. */
.pay-field-tel .iti__country-container {
  border-right: 1px solid var(--line);
}

.pay-field-tel .iti__selected-country,
.pay-field-tel .iti__selected-country-primary {
  border-radius: 14px 0 0 14px;
}

.pay-field-tel .iti:focus-within .iti__country-container {
  border-right-color: var(--teal);
}

/* Dial code reads as a real label, not muted gray */
.pay-field-tel .iti__selected-dial-code {
  font-weight: 600;
  font-size: 14px;
}

/* Country dropdown panel — sits above our modal (z=1000) and backdrop. */
.iti--container,
.iti__dropdown-content,
.iti__country-list {
  z-index: 2000 !important;
}

/* Dropdown panel as a proper card so it doesn't float unanchored on the page */
.iti__dropdown-content {
  border: 1px solid var(--line);
  border-radius: 16px !important;
  box-shadow: 0 22px 60px rgba(16, 25, 54, 0.22);
  overflow: hidden;
  background: white;
  min-width: 280px;
}

/* Search input inside the dropdown — match the modal's field aesthetic */
.iti__search-input {
  width: 100%;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  padding: 12px 16px !important;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: white;
  -webkit-appearance: none;
  appearance: none;
}

.iti__search-input::placeholder {
  color: rgba(82, 87, 117, 0.55);
}

.iti__search-input:focus {
  outline: none;
  background: rgba(196, 109, 125, 0.04);
}

/* Country rows — readable spacing, our hover tint */
.iti__country-list {
  max-height: 280px;
  padding: 4px 0;
}

.iti__country {
  padding: 10px 14px;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
}

.iti__country.iti__highlight {
  background-color: var(--iti-hover-color);
}

/* Mute the dial code in the list so the country name leads */
.iti__country-list .iti__dial-code {
  color: rgba(82, 87, 117, 0.65);
  font-size: 13px;
  font-weight: 500;
}

/* Narrow phones — compact the country chip so it shares the row */
@media (max-width: 380px) {
  .pay-field-tel .iti {
    --iti-spacer-horizontal: 8px;
    --iti-arrow-padding: 6px;
  }
  .pay-field-tel .iti__selected-dial-code {
    font-size: 13px;
  }
  .pay-field-tel .iti input.iti__tel-input {
    font-size: 15px;
    padding-right: 12px;
  }
}

/* ===== DODO full-screen checkout overlay ===== */
.dodo-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  background: rgba(20, 18, 24, 0.92);
}
.dodo-overlay.open { display: block; }
body.dodo-overlay-open { overflow: hidden; }

.dodo-overlay-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 16px;
  overflow-y: auto;
}

.dodo-overlay-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  border: 0;
  cursor: pointer;
}
.dodo-overlay-close:hover { background: rgba(255, 255, 255, 0.2); }

.dodo-overlay-summary {
  width: 100%;
  max-width: 480px;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
}
.dodo-summary-title  { font-size: 18px; font-weight: 600; }
.dodo-summary-amount { font-size: 28px; font-weight: 700; margin-top: 4px; }

.dodo-overlay-banner {
  width: 100%;
  max-width: 480px;
  color: #fff;
  background: rgba(220, 70, 70, 0.22);
  border: 1px solid rgba(220, 70, 70, 0.45);
  border-radius: 8px;
  min-height: 0;
  padding: 0 14px;
}
.dodo-overlay-banner:not(:empty) {
  padding: 10px 14px;
  margin-bottom: 14px;
}

.dodo-overlay-frame {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  min-height: 360px;
}

@media (max-width: 520px) {
  .dodo-overlay-inner { padding: 24px 12px; }
  .dodo-overlay-frame { padding: 14px; }
}

/* ===== Recurring-billing disclosure (monthly plan only) ===== */
.pay-recurring-note {
  margin: 14px 0 8px;
  padding: 10px 14px;
  background: rgba(196, 109, 125, 0.08);
  border: 1px solid rgba(196, 109, 125, 0.22);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink, #1b1726);
}
.pay-recurring-note strong { color: var(--ink, #1b1726); }
.pay-recurring-note a {
  color: #c46d7d;
  text-decoration: underline;
  font-weight: 600;
}

/* ============================================================
   DODO inline-checkout wrapper
   ------------------------------------------------------------
   Deliberately minimal. ONE scrollable surface (.dodo-wrap)
   that contains a max-520px column. The iframe inside is left
   to size itself — we do not set height/max-height on it.
   When DODO's iframe is taller than the viewport, the wrapper
   scrolls. Body is locked so the page can't scroll behind.
   ============================================================ */

.dodo-wrap {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: none;
  background: rgba(15, 13, 20, 0.78);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.dodo-wrap.open { display: block; }
html:has(.dodo-wrap.open),
body.dodo-wrap-open { overflow: hidden; }

.dodo-wrap-inner {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 56px 16px 40px;
  box-sizing: border-box;
}

.dodo-wrap-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dodo-wrap-close:hover,
.dodo-wrap-close:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  outline: none;
}

.dodo-wrap-summary {
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  padding: 0 12px;
}
.dodo-wrap-title  { font-size: 14px; font-weight: 600; opacity: 0.85; letter-spacing: 0.02em; }
.dodo-wrap-amount { font-size: 26px; font-weight: 700; margin-top: 4px; }

.dodo-wrap-banner {
  color: #fff;
  background: rgba(220, 70, 70, 0.22);
  border: 1px solid rgba(220, 70, 70, 0.45);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  line-height: 1.5;
}
.dodo-wrap-banner:not(:empty) {
  padding: 10px 14px;
  margin-bottom: 14px;
}

/* DODO's iframe mount. No height clamp — iframe sizes itself,
   wrapper scrolls if content is taller than viewport. */
.dodo-wrap-frame {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.dodo-wrap-frame iframe {
  display: block;
  width: 100%;
  border: 0;
}

@media (max-width: 560px) {
  .dodo-wrap-inner { padding: 52px 10px 32px; }
  .dodo-wrap-amount { font-size: 22px; }
  .dodo-wrap-frame { border-radius: 10px; }
}
