/* ==========================================================================
   Pluxee Bridge — "Quiet Premium" design system
   Shared by form.ejs / success.ejs / error.ejs. No inline <style> anywhere.
   ========================================================================== */

:root {
  /* Palette */
  --ink: #221c46;
  --body: #3e3a55;
  --secondary: #595670;
  --violet: #5d2fb5;
  --violet-deep: #4a2491;
  --violet-light: #c4b5fd;
  --success: #0e7c4a;
  --success-bg: #e7f6ee;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --border: #e4e1ef;
  --field-border: #d9d6e4;
  --page-bg: #f6f5fa;
  --card-bg: #ffffff;
  --processing-bg: #efeafb;
  --badge-bg: #f1eef9;
  --help-bg: #f7f6fb;
  --focus-outline: #7c53d6;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* Radii */
  --radius-card: 20px;
  --radius-input: 12px;
  --radius-button: 12px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-card: 0 1px 2px rgba(34, 28, 70, 0.05),
    0 12px 32px -8px rgba(34, 28, 70, 0.12),
    0 32px 80px -24px rgba(93, 47, 181, 0.18);
  --shadow-button: inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(34, 28, 70, 0.22),
    0 8px 16px -8px rgba(93, 47, 181, 0.45);
}

/* ─── Base ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--body);
  background-color: var(--page-bg);
  background-image: radial-gradient(
      640px 420px at 15% -10%,
      rgba(93, 47, 181, 0.09),
      transparent
    ),
    radial-gradient(640px 420px at 110% 110%, rgba(93, 47, 181, 0.06), transparent);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* ─── Card ─────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 40px 36px;
}

.card--center {
  text-align: center;
}

/* ─── Language switcher (segmented pill row) ───────────────────────────── */

.lang-switcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.lang-switcher__group {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--badge-bg);
  border-radius: var(--radius-pill);
}

.lang-switcher__group a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--secondary);
  text-decoration: none;
}

.lang-switcher__group a[aria-current] {
  background: var(--card-bg);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(34, 28, 70, 0.12);
}

/* ─── Logo ─────────────────────────────────────────────────────────────── */

.logo-area {
  text-align: center;
  margin-bottom: 24px;
}

.logo-area img {
  height: 30px;
  width: auto;
  object-fit: contain;
}

/* ─── Headings ─────────────────────────────────────────────────────────── */

.card-title {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 15px;
  font-weight: 400;
  color: var(--secondary);
  text-align: center;
  margin-bottom: 24px;
}

/* ─── Fields ───────────────────────────────────────────────────────────── */

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 8px;
}

.field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius-input);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  background: var(--card-bg);
  -webkit-appearance: none;
  appearance: none;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(93, 47, 181, 0.14);
}

/* Error state: border + ring + tinted bg */
.field input[type="text"].error {
  border-color: var(--error);
  background: #fef9f9;
}

.field input[type="text"].error:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.field-hint {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--secondary);
}

/* Inline field error (icon + text) */
.error-msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--error);
}

.error-msg svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.captcha-error {
  justify-content: center;
}

/* Form-level alert (role="alert", left error bar) */
.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--error-bg);
  border-left: 3px solid var(--error);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--error);
}

.form-alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── Honeypot — completely hidden (copied verbatim from old form.ejs) ─── */

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  tab-index: -1;
}

/* ─── hCaptcha (304px widget; reserve height to avoid CLS) ─────────────── */

.captcha-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 78px;
  margin-bottom: 20px;
}

.captcha-wrap .h-captcha {
  min-height: 78px;
}

@media (max-width: 400px) {
  .captcha-wrap .h-captcha {
    zoom: 0.9;
  }
}

/* ─── Primary button ───────────────────────────────────────────────────── */

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-button);
  background: linear-gradient(180deg, #6b3bc9, #5d2fb5);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  cursor: default;
}

.btn-primary.is-loading:hover {
  transform: none;
  filter: none;
}

/* Inline-flex variant (error page retry link) */
.btn-primary--inline {
  display: inline-flex;
  width: auto;
  min-width: 200px;
  padding: 0 28px;
  margin-top: 24px;
}

/* Loading spinner (CSS border ring, shown by bridge.js) */
.btn-primary__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
}

.btn-primary.is-loading .btn-primary__spinner {
  display: inline-block;
}

.btn-primary.is-loading .btn-primary__icon {
  display: none;
}

/* ─── Help box ─────────────────────────────────────────────────────────── */

.help-box {
  margin-top: 24px;
  background: var(--help-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.help-box-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 4px;
}

.help-box-title svg {
  color: var(--violet);
  flex-shrink: 0;
}

.help-box-text {
  font-size: 13px;
  color: var(--secondary);
  line-height: 1.5;
}

/* ─── Status well (success / processing / error) ───────────────────────── */

.status-well {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.status-well--paid {
  background: var(--success-bg);
  color: var(--success);
}

.status-well--processing {
  background: var(--processing-bg);
  color: var(--violet);
}

.status-well--error {
  background: var(--error-bg);
  color: var(--error);
}

/* Conic progress ring around the processing well (static ring by default,
   spun only when reduced motion is off) */
.status-well--processing::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(93, 47, 181, 0) 0 70%,
    var(--violet) 100%
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3.5px),
    #000 calc(100% - 3px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3.5px),
    #000 calc(100% - 3px)
  );
}

/* ─── Status text + order badge ────────────────────────────────────────── */

.status-message {
  font-size: 15px;
  color: var(--body);
  line-height: 1.6;
}

.status-note {
  font-size: 13px;
  color: var(--secondary);
  line-height: 1.5;
  margin-top: 8px;
}

.order-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--violet);
  font-weight: 600;
  font-size: 14px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
}

/* ─── Brand footer (divider + trust line + Pluxee logo) ────────────────── */

.brand-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--secondary);
}

.brand-footer svg {
  color: var(--success);
  flex-shrink: 0;
}

.brand-footer__logo {
  height: 20px;
  width: auto;
  opacity: 0.75;
}

/* ─── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 540px) {
  body {
    padding: 16px;
  }

  .card {
    padding: 28px 20px;
  }

  .card-title {
    font-size: 22px;
  }
}

/* ─── Motion (all animations gated behind no-preference) ───────────────── */

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: card-in 420ms ease-out both;
  }

  .field input[type="text"],
  .btn-primary,
  .lang-switcher__group a {
    transition: border-color 150ms, box-shadow 150ms, background-color 150ms,
      color 150ms, transform 150ms, filter 150ms;
  }

  .btn-primary.is-loading .btn-primary__spinner {
    animation: spin 0.8s linear infinite;
  }

  .status-well--processing::after {
    animation: spin 1.2s linear infinite;
  }

  .status-well--paid .check-path {
    stroke-dasharray: 26;
    stroke-dashoffset: 26;
    animation: draw 500ms ease-out 200ms forwards;
  }
}
