/* ===== PW RESET — CLEAN, CENTERED, NO LEFT-SHIFT (iOS SAFE) ===== */

/* Base font */
html, body { height: 100%; }
html, body, * {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
               Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Hide theme chrome only on this page (when #pwroot exists) */
body #pwroot ~ header,
body #pwroot ~ #header,
body #pwroot ~ .header,
body #pwroot ~ footer,
body #pwroot ~ #footer,
body #pwroot ~ .footer,
body #pwroot ~ .page-footer,
body #pwroot ~ .layout__footer,
body #pwroot .breadcrumb,
body #pwroot .page-header,
body #pwroot .page-title,
body #pwroot .page-footer {
  display: none !important;
}

/* Kill sidebars / columns on this page */
body:has(#pwroot) #left-column,
body:has(#pwroot) #right-column,
body:has(#pwroot) .left-column,
body:has(#pwroot) .right-column,
body:has(#pwroot) .sidebar,
body:has(#pwroot) .layout__left-column,
body:has(#pwroot) .layout__right-column {
  display: none !important;
}
body:has(#pwroot) #content-wrapper,
body:has(#pwroot) #wrapper .container,
body:has(#pwroot) #wrapper .row,
body:has(#pwroot) #main .container,
body:has(#pwroot) #main .row {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Background */
body:has(#pwroot) { background: #7c3aed80 !important; }

/* Prevent horizontal scrollbars anywhere */
html, body, #wrapper, #content, #main { overflow-x: hidden !important; }
html, body { overscroll-behavior: contain; }

/* ===== ROOT: full-screen, fixed, perfectly centered =====
   We center with CSS grid and CANCEL iOS visualViewport horizontal offset
   using translateX(-var(--vv-left)). Your JS sets --vv-left. */
.pw-root {
  position: fixed;
  inset: 0;                           /* fill screen */
  display: grid;
  place-items: center;                /* perfect center */
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  box-sizing: border-box;
  min-height: 100svh;                 /* keyboard-aware */
  transform: translateX(calc(var(--vv-left, 0px) * -1)); /* CANCEL left nudge on iOS */
  transition: none !important;
}

/* When keyboard opens (we add .pw-focus from JS), keep vertical alignment top,
   but DO NOT move horizontally */
html.pw-focus .pw-root,
body.pw-focus .pw-root {
  place-items: start center;
  padding-top: max(24px, env(safe-area-inset-top));
}

/* ===== LOGO ===== */
.pw-logo {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.pw-logo img {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.18));
}

/* ===== CARD ===== */
.pw-card {
  width: 100%;
  max-width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.16), 0 4px 10px rgba(16, 24, 40, 0.08);
  border: 1px solid rgba(255,255,255,0.6);
  transition: none !important;
}

/* ===== TITLES & EMAIL ===== */
.pw-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
  text-align: center;
  font-weight: 700;
  color: #111827;
}
.pw-email {
  margin: 0 0 18px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

/* ===== RULES LIST (live) ===== */
.pw-rules {
  margin: 6px 0 16px;
  padding: 0;
  list-style: none;
  color: #6b7280;
  font-size: 14px;
}
.pw-rules li {
  position: relative;
  padding-left: 22px;
  margin: 6px 0;
}
.pw-rules li::before {
  content: "✗";
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1;
  color: #b42318;
  font-weight: 700;
}
.pw-rules li[data-state="ok"] {
  color: #0f7a43;
}
.pw-rules li[data-state="ok"]::before {
  content: "✓";
  color: #0f7a43;
}

/* ===== FORM ===== */
.pw-field { margin-bottom: 14px; }
.pw-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}
.pw-input {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  font-size: 16px; /* >=16 to avoid iOS zoom */
  background: #fff;
  transition: box-shadow .15s, border-color .15s;
}
.pw-input::placeholder { color: #94a3b8; }
.pw-input:focus {
  outline: none;
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,.20);
}

/* Messages */
.pw-msg { margin: 0 0 12px; }
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert-success {
  background: #e8fbef;
  color: #0f7a43;
  border-color: #b9f3cf;
}
.alert-error {
  background: #feecec;
  color: #b42318;
  border-color: #f8b4b4;
}
.pw-list { margin: 8px 0 0 18px; }

/* Actions */
.pw-actions { margin-top: 12px; }
.pw-btn {
  width: 100%;
  display: inline-block;
  text-align: center;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: #7c3aed;
  border: 1px solid #7c3aed;
}
.pw-btn:hover { filter: brightness(0.95); }
.pw-btn.is-loading { opacity: .7; pointer-events: none; }

/* Help */
.pw-help {
  margin-top: 14px;
  text-align: center;
  color: #e9e6ff;
}
.pw-help a { color: #ffffff; text-decoration: underline; }

/* Mobile polish */
@media (max-width: 480px) {
  .pw-card { padding: 20px; border-radius: 14px; }
  .pw-title { font-size: 20px; }
  .pw-input { height: 42px; }
}

.pw-email-expired {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #6b7280; /* gris doux */
}

.pw-email-expired .pw-link {
  color: #7c3aed; /* même violet que le reste si tu en as */
  text-decoration: underline;
  font-weight: 600;
}



/* ===== Contact layout inside the card ===== */
.pw-contact-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.pw-contact-main {
  flex: 1 1 260px;
}

.pw-contact-side {
  flex: 0 0 220px;
  font-size: 14px;
  color: #4b5563;
}

.pw-contact-side-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.pw-contact-info-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.pw-contact-info-label {
  font-size: 18px;
  line-height: 1;
}

.pw-contact-info-text a {
  color: #7c3aed;
  text-decoration: underline;
}

/* Textarea style to match inputs */
.pw-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Mobile: stack side info under the form */
@media (max-width: 640px) {
  .pw-contact-layout {
    flex-direction: column;
  }
  .pw-contact-side {
    flex: 1 1 auto;
  }
}

/* Permettre le scroll global si la carte devient trop grande */
html, body {
  height: auto;
  min-height: 100%;
}

/* Le root peut scroller si le contenu dépasse */
.pw-root {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;   /* plus en haut qu'au centre => laisse la place en bas */
  padding: 32px 16px 40px;   /* un peu de marge en bas */
  overflow-y: auto;          /* <<< autorise le scroll quand c'est trop grand */
}

/* La carte reste limitée en largeur, mais hauteur auto */
.pw-card {
  width: 100%;
  max-width: 640px;
}

/* Description du sujet sous le select */
.pw-desc {
  margin-top: 8px;              /* petit gap par rapport au select */
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;           /* centré */
  color: #51555c;               /* gris doux */
  background: #f9fafb;          /* léger fond pour bien détacher */
  border-radius: 999px;         /* petit effet "pill" sinon mets 8px */
}

.pw-desc {
  border-radius: 8px;
}


/* === Welcome / Landing page tweaks === */
.pw-welcome-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.pw-welcome-actions .pw-btn {
  min-width: 220px;
  max-width: 260px;
  text-align: center;
  justify-content: center; /* si .pw-btn est en flex */
  white-space: nowrap;
}

.pw-email-help {
  margin-top: 18px;
  font-size: 14px;
  color: #6b7280;
}



.pw-cms-card {
  max-width: 840px;
}

.pw-cms-content {
  text-align: left;
  color: #111827;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 16px;
}

.pw-cms-content h1,
.pw-cms-content h2,
.pw-cms-content h3 {
  margin: 1.5rem 0 0.75rem;
}

.pw-cms-content p {
  margin: 0.5rem 0;
}
