/**
 * Letters by Heart – shared styles for auth and payment modals.
 * Used by modals-i18n.js (create and puzzle create pages).
 */

/* ----- Auth modal ----- */
#authModal.lbh-modal,
.lbh-auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

/* Match create form width: .form-container is max-width: 420px, width: 100% */
#authModal .lbh-modal-inner {
  background: white;
  padding: 40px;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-sizing: border-box;
}

#authModal .lbh-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #831843;
}

#authModal .lbh-modal-title {
  color: #be185d;
  margin-bottom: 20px;
  font-size: 22px;
}

#authModal .lbh-auth-error {
  color: #b91c1c;
  margin-bottom: 15px;
  font-size: 14px;
}

#authModal .lbh-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #f8bbd9;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}

#authModal .lbh-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
}

#authModal .lbh-btn-primary {
  background: linear-gradient(90deg, #be185d, #f472b6);
  color: white;
  margin-bottom: 10px;
}

#authModal .lbh-btn-secondary {
  background: #f8bbd9;
  color: #be185d;
}

#authModal .lbh-auth-divider {
  text-align: center;
  margin: 20px 0;
  color: #831843;
}

#authModal .lbh-btn-google {
  background: white;
  color: #3d2b2b;
  border: 2px solid #f8bbd9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#authModal .lbh-auth-terms {
  margin: 20px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #831843;
  text-align: center;
}

#authModal .lbh-auth-terms a {
  color: #be185d;
  text-decoration: underline;
}

#authModal .lbh-auth-terms a:hover {
  color: #9d174d;
}

/* ----- Payment modal ----- */
#paymentModal.lbh-modal,
.lbh-payment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

#paymentModal .lbh-modal-inner {
  background: white;
  padding: 40px;
  padding-top: 50px;
  border-radius: 20px;
  max-width: 450px;
  width: 100%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
  overflow-y: auto;
  max-height: 90vh;
  box-sizing: border-box;
}

#paymentModal .lbh-payment-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #831843;
  padding: 4px;
  line-height: 1;
  z-index: 10001;
  font-weight: bold;
}

#paymentModal .lbh-payment-close:hover {
  color: #be185d;
}

#paymentModal .lbh-payment-title {
  color: #be185d;
  margin-bottom: 8px;
  font-size: 24px;
  text-align: center;
  margin-top: 0;
  font-weight: 700;
}

#paymentModal .lbh-payment-reason {
  background: #fff5f9;
  border: 1px solid #f8bbd9;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  text-align: center;
}

#paymentModal .lbh-payment-reason-text {
  color: #831843;
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

#paymentModal .lbh-char-count {
  color: #be185d;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

#paymentModal .lbh-lifetime-deal {
  background: linear-gradient(135deg, #fef2f8 0%, #fce7f3 100%);
  border: 2px solid #be185d;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(190, 24, 93, 0.2);
  position: relative;
  overflow: hidden;
}

#paymentModal .lbh-deal-title {
  color: #be185d;
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}

#paymentModal .lbh-countdown {
  color: #831843;
  margin: 0;
  font-weight: 700;
  font-size: 20px;
  font-family: 'Courier New', monospace;
}

#paymentModal .shine-overlay {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: lbh-shine 3s infinite;
  pointer-events: none;
}

@keyframes lbh-shine {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

#paymentModal .lbh-currency-row {
  margin-bottom: 20px;
  text-align: center;
}

#paymentModal .lbh-currency-label {
  color: #831843;
  font-size: 14px;
  margin-right: 8px;
}

#paymentModal .lbh-currency-select {
  padding: 8px 12px;
  border: 1px solid #f8bbd9;
  border-radius: 8px;
  background: white;
  color: #831843;
  font-size: 14px;
  cursor: pointer;
}

#paymentModal .lbh-plans-section {
  margin-bottom: 20px;
}

#paymentModal .lbh-plans-label {
  color: #831843;
  margin-bottom: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#paymentModal .lbh-forever-card {
  border: 2px solid #be185d;
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(135deg, #fef2f8 0%, #fce7f3 100%);
  position: relative;
  box-shadow: 0 4px 12px rgba(190, 24, 93, 0.15);
}

#paymentModal .lbh-most-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #be185d;
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

#paymentModal .lbh-forever-title {
  color: #be185d;
  margin: 16px 0 8px 0;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

#paymentModal .lbh-forever-desc {
  color: #831843;
  margin: 0 0 20px 0;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

#paymentModal .lbh-usd-price {
  margin: 0 0 16px 0;
  font-size: 28px;
  font-weight: 700;
  color: #be185d;
  text-align: center;
  line-height: 1.2;
}

#paymentModal .lbh-stripe-checkout {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow: hidden;
  margin-top: 8px;
}

#paymentModal .lbh-secure-text {
  color: #831843;
  margin-top: 24px;
  margin-bottom: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

/* Stripe button constraints */
#paymentModal stripe-buy-button {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
  display: block !important;
  box-sizing: border-box !important;
}

#paymentModal #stripeCheckout {
  width: 100%;
  overflow: hidden;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  position: relative !important;
  z-index: 1 !important;
}

#paymentModal #stripeCheckout stripe-buy-button {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
  display: block !important;
  position: relative !important;
  z-index: 10 !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
}

#paymentModal #stripeCheckout > div,
#paymentModal #stripeCheckout > div > div {
  pointer-events: none !important;
}

#paymentModal #stripeCheckout > div > div > stripe-buy-button,
#paymentModal #stripeCheckout stripe-buy-button {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  z-index: 10 !important;
  position: relative !important;
}

/* Optional second Stripe container (puzzle) */
#paymentModal #checkoutDigital,
#paymentModal #checkoutBundle {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: none !important;
}

#paymentModal #checkoutDigital stripe-buy-button,
#paymentModal #checkoutBundle stripe-buy-button {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
  z-index: 10 !important;
  position: relative !important;
}

/* Match create.css: form and preview use 92vw at 920px */
@media (max-width: 920px) {
  #authModal .lbh-modal-inner {
    max-width: 92vw;
  }
}

@media (max-width: 480px) {
  #authModal.lbh-modal,
  .lbh-auth-modal {
    padding: 10px;
  }
  #authModal .lbh-modal-inner {
    max-width: 92vw;
  }
  #paymentModal {
    padding: 10px;
  }
  #paymentModal .lbh-modal-inner {
    padding: 30px 20px;
    padding-top: 45px;
    border-radius: 15px;
    max-height: 95vh;
  }
  #paymentModal .lbh-payment-close {
    top: 8px;
    right: 8px;
    font-size: 20px;
  }
  #paymentModal .lbh-payment-title {
    font-size: 24px;
    margin-bottom: 10px;
  }
  #paymentModal #stripeCheckout {
    min-height: 50px !important;
  }
  #paymentModal #stripeCheckout stripe-buy-button {
    min-height: 50px !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  #paymentModal #stripeCheckout stripe-buy-button::part(button),
  #paymentModal #stripeCheckout stripe-buy-button button,
  #paymentModal #checkoutDigital stripe-buy-button::part(button),
  #paymentModal #checkoutDigital stripe-buy-button button,
  #paymentModal #checkoutBundle stripe-buy-button::part(button),
  #paymentModal #checkoutBundle stripe-buy-button button {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
  }
}
