/*
 * FormVault Bundle Checkout — Modal styles.
 * References tokens.css custom properties.
 * ────────────────────────────────────────────────────────────────────────────
 */

/* ── Backdrop ────────────────────────────────────────────────────────────── */
.fv-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 99998;
  backdrop-filter: blur(2px);
}

/* ── Modal container ─────────────────────────────────────────────────────── */
.fv-bundle-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: var(--fv-radius-xl, 24px);
  box-shadow: var(--fv-shadow-xl, 0 24px 64px rgba(15,23,42,0.2));
  padding: 32px 28px 28px;
  -webkit-overflow-scrolling: touch;
}

/* ── Close button ────────────────────────────────────────────────────────── */
.fv-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--fv-ink-050, #f8fafc);
  border-radius: 50%;
  cursor: pointer;
  color: var(--fv-ink-500, #64748b);
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.fv-modal-close:hover {
  background: var(--fv-ink-100, #f1f5f9);
  color: var(--fv-ink-900, #0f172a);
}

.fv-modal-close svg {
  width: 16px;
  height: 16px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.fv-modal-header {
  margin-bottom: 20px;
  padding-right: 28px;
}

.fv-modal-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--fv-ink-950, #0f172a);
  font-family: var(--fv-font-heading, inherit);
}

.fv-modal-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--fv-ink-500, #64748b);
}

/* ── Success state ───────────────────────────────────────────────────────── */
.fv-modal-success {
  text-align: center;
  padding: 8px 0;
}

.fv-modal-success__icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
}

.fv-modal-success__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--fv-ink-950, #0f172a);
}

.fv-modal-success__desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--fv-ink-600, #475569);
}

.fv-modal-success__note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--fv-ink-400, #94a3b8);
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.fv-field {
  margin-bottom: 16px;
}

.fv-field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fv-ink-700, #334155);
  margin-bottom: 6px;
}

.fv-field__input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--fv-ink-200, #e2e8f0);
  border-radius: var(--fv-radius-md, 10px);
  font-size: 15px;
  color: var(--fv-ink-900, #0f172a);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.fv-field__input:focus {
  outline: none;
  border-color: var(--fv-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Stripe card ─────────────────────────────────────────────────────────── */
.fv-payment-section {
  margin-bottom: 16px;
}

.fv-payment-section__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fv-ink-700, #334155);
  margin: 0 0 8px;
}

.fv-stripe-card {
  padding: 12px;
  border: 1.5px solid var(--fv-ink-200, #e2e8f0);
  border-radius: var(--fv-radius-md, 10px);
  background: #fff;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fv-stripe-card.StripeElement--focus {
  border-color: var(--fv-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.fv-card-errors {
  color: #dc2626;
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 4px;
}

/* ── Checkout error ──────────────────────────────────────────────────────── */
.fv-checkout-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--fv-radius-md, 10px);
  padding: 10px 14px;
  color: #b91c1c;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Pay button ──────────────────────────────────────────────────────────── */
.fv-btn--full {
  width: 100%;
  justify-content: center;
}

/* Spinner */
.fv-pay-btn__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fv-spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── Divider ─────────────────────────────────────────────────────────────── */
.fv-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--fv-ink-300, #cbd5e1);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fv-or-divider::before,
.fv-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--fv-ink-100, #f1f5f9);
}

/* ── PayPal container ────────────────────────────────────────────────────── */
#fv-paypal-buttons {
  margin-bottom: 16px;
}

/* ── Security note ───────────────────────────────────────────────────────── */
.fv-secure-note {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  font-size: 12px;
  color: var(--fv-ink-400, #94a3b8);
  margin: 16px 0 0;
}

.fv-secure-note__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ── Not-configured notice ───────────────────────────────────────────────── */
.fv-modal-notice {
  color: var(--fv-ink-500, #64748b);
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .fv-bundle-modal {
    padding: 24px 20px 20px;
    border-radius: var(--fv-radius-lg, 16px) var(--fv-radius-lg, 16px) 0 0;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 92dvh;
  }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .fv-bundle-modal {
    background: #1e293b;
    color: #f8fafc;
  }
  .fv-modal-title,
  .fv-modal-success__title { color: #f8fafc; }
  .fv-field__input,
  .fv-stripe-card { background: #0f172a; border-color: #334155; color: #f8fafc; }
  .fv-modal-close { background: #334155; color: #94a3b8; }
}
