/* ==========================================================
   Client — page connexion (index.php) uniquement
   ========================================================== */

html:has(.login-shell) {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  /* Allow Google Sign-In iframe + shadow to extend slightly without clipping */
  overflow-x: visible;
  box-sizing: border-box;
}
body.login-shell {
  /* System stack only: no webfont download on this page — removes mobile FOUT/FIT */
  --ff-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ff-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-family: var(--ff-primary);
  font-synthesis: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: visible;
  box-sizing: border-box;
}
.login-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.login-shell-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #002e33;
  padding: 1.125rem 2.5rem;
  flex-shrink: 0;
}
@media (min-width: 900px) {
  .login-shell-header {
    padding: 0.625rem 1.5rem;
  }
}
.login-shell-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}
.login-shell-brand:focus-visible {
  outline: 2px solid var(--c-secondary);
  outline-offset: 4px;
  border-radius: 4px;
}
.login-shell-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
@media (min-width: 900px) {
  .login-shell-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    /* Stable row height before image / fonts settle (avoids column “breathing”). */
    min-height: calc(100vh - 5.5rem);
    min-height: calc(100dvh - 5.5rem);
  }
}
.login-shell-visual {
  display: none;
  min-height: 0;
  background: var(--c-gray-100);
}
@media (min-width: 900px) {
  .login-shell-visual {
    display: block;
    min-height: calc(100vh - 5.5rem);
    min-height: calc(100dvh - 5.5rem);
  }
}
.login-shell-visual img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  display: block;
}
.login-shell-form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--c-white);
  padding: 2rem 1.5rem;
  /* Visible on both axes: overflow-y:auto forces overflow-x to "auto" in CSS and clips the GSI button. */
  overflow: visible;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 900px) {
  .login-shell-form-col {
    padding: 1.5rem 2rem;
    /* Avoid vertical re-centering when fonts / GSI load (was causing stretch then shrink). */
    justify-content: flex-start;
    padding-top: clamp(1.25rem, 5vh, 2.75rem);
  }
}
.login-inner {
  width: 100%;
  max-width: 432px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* Mot de passe oublié — uniquement dans la colonne formulaire (photo gauche inchangée) */
body.login-shell.login-shell--forgot-page {
  background-color: #ffffff;
}
.login-shell.login-shell--forgot-page .login-shell-form-col,
.login-shell-form-col.login-shell-form-col--forgot {
  background-color: #ffffff;
  color: var(--c-gray-900, #111827);
}
.login-forgot-view {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding-top: 0.25rem;
}

/* Saisie nouveau mot de passe (index.php?password_reset=…) — même gabarit que mot de passe oublié */
.login-password-reset-view {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding-top: 0.25rem;
}
.login-forgot-back {
  display: inline-block;
  align-self: flex-start;
  margin: 0 0 1.75rem;
  font-size: var(--fs-14, 0.875rem);
  font-weight: var(--fw-semibold, 600);
  color: var(--c-gray-800, #1f2937);
  text-decoration: none;
  line-height: 1.35;
}
.login-forgot-back:hover,
.login-forgot-back:focus {
  color: #000000;
  text-decoration: underline;
}
.login-forgot-title {
  margin: 0 0 1rem;
  width: 100%;
  text-align: center;
  line-height: 1.12;
  color: #000000;
  font-weight: var(--fw-bold, 700);
}
.login-forgot-lead {
  margin: 0 0 2rem;
  width: 100%;
  text-align: center;
  font-size: var(--fs-14, 0.875rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--c-gray-600, #4b5563);
}
.login-forgot-label,
.login-shell-form-col--forgot .login-forgot-view .form-ccom-label {
  color: var(--c-gray-900, #111827);
  text-align: left;
}
.login-shell-form-col--forgot .login-forgot-view .form-ccom-input {
  background-color: #f4f4f5;
  border: 1px solid var(--c-gray-200, #e5e7eb);
  border-radius: var(--radius-md, 8px);
}
.login-forgot-field-email {
  margin-top: 0.25rem;
  text-align: left;
}
.login-forgot-submit {
  margin-top: 1.125rem;
}
.login-password-rules {
  margin: 0.75rem 0 0.25rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.login-password-rule {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-13, 0.8125rem);
  line-height: 1.35;
}
.login-password-rule__icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
}
.login-password-rule--ok {
  color: #198754;
}
.login-password-rule--ok .login-password-rule__icon::before {
  content: "\2713";
}
.login-password-rule--invalid {
  color: var(--c-danger, #dc3545);
}
.login-password-rule--invalid .login-password-rule__icon::before {
  content: "\2715";
}
.login-password-rules + .login-forgot-field-email {
  padding-top: 10px;
}
.login-forgot-submit .btn-ccom.btn-ccom-primary {
  background-color: #12262b;
  border-color: #12262b;
  color: #ffffff;
}
.login-forgot-submit .btn-ccom.btn-ccom-primary:hover,
.login-forgot-submit .btn-ccom.btn-ccom-primary:focus {
  background-color: #0d1c20;
  border-color: #0d1c20;
  color: #ffffff;
}
.login-forgot-view .login-forgot-success {
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--c-gray-600, #4b5563);
  font-size: var(--fs-14, 0.875rem);
  line-height: 1.5;
}
.login-forgot-view .login-forgot-error {
  margin: 0 0 1.25rem;
  text-align: center;
}
/* Blocs formulaire plus compacts sur la page connexion */
.login-shell .form-ccom {
  gap: 0.375rem;
}
.login-shell .form-ccom-label {
  line-height: 1.25;
}
.login-preprod-h1 {
  margin-bottom: 0.625rem;
  line-height: 1.12;
  /* Match .text-display (fs-40 × lh-tight) so Web font swap does not change block height. */
  min-height: calc(var(--fs-40, 2.5rem) * var(--lh-tight, 1));
}
.login-preprod-lang {
  padding-top: 0;
}
.login-preprod-field-username {
  margin-top: 0.625rem;
}

.login-preprod-phone-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
}
.login-preprod-phone-prefix {
  flex: 0 0 auto;
  min-width: 4.75rem;
  max-width: 6.5rem;
}
.login-preprod-phone-number {
  flex: 1 1 auto;
  min-width: 0;
}

/* Fixed vertical slot for GSI (iframe ~40px + Google wrapper margins); prevents bottom “breathing”. */
.login-google-wrap {
  --ccom-google-slot-height: 4rem;
  width: 100%;
  align-items: stretch;
  padding-left: 2px;
  padding-right: 2px;
  box-sizing: border-box;
  min-height: var(--ccom-google-slot-height);
}
.login-google-inner {
  width: 100%;
  max-width: 100%;
  /* Avoid min-width:0 here: grid/flex can shrink below the GSI iframe width and clip .container-div. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
  overflow: visible;
  min-height: var(--ccom-google-slot-height);
  flex-shrink: 0;
}
.ccom-google-signin-outer {
  position: relative;
  width: 100%;
  height: var(--ccom-google-slot-height);
  min-height: var(--ccom-google-slot-height);
  overflow: visible;
  flex-shrink: 0;
}
/* Covers the GSI mount until the cross-origin iframe fires load (hides Roboto FOUT inside iframe). */
.ccom-google-signin-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  box-sizing: border-box;
  background: var(--c-white, #ffffff);
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.ccom-google-signin-veil__label {
  font-size: var(--fs-14, 0.875rem);
  font-weight: 400;
  line-height: 1.35;
  color: var(--c-gray-500, #6b7280);
  text-align: center;
}
.ccom-google-signin-veil--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .ccom-google-signin-veil {
    transition: none;
  }
}
.ccom-google-signin-host {
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  font-weight: 400;
  font-synthesis: none;
}
/* GSI injects wrapper divs including .container-div; max-width:100% on those caused label cut-off. */
.ccom-google-signin-host > div {
  overflow: visible;
  max-width: none;
  width: auto;
  font-weight: 400;
  font-synthesis: none;
}
.ccom-google-signin-host .container-div {
  overflow: visible;
  max-width: none;
  font-weight: 400;
  font-synthesis: none;
}
.ccom-google-signin-host iframe {
  display: block;
  max-width: none;
}
.login-preprod-switch {
  margin-top: 0.375rem;
}
.login-preprod-field-password {
  margin-top: 0.625rem;
}

.login-preprod-password-error {
  margin: 8px 0 0;
  font-size: var(--fs-13, 0.8125rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--c-danger, #dc2626);
}

.login-preprod-password-error-link {
  font-weight: 400;
  color: inherit;
  text-decoration: underline;
}

.login-preprod-password-error-link:hover {
  color: inherit;
  text-decoration: underline;
}

.login-preprod-remember {
  margin-top: 0.5rem;
}
.login-preprod-submit {
  margin-top: 0.75rem;
}
@media (min-width: 900px) {
  .login-preprod-submit {
    margin-top: 1rem;
  }
}
.login-preprod-forgot {
  margin-top: 0.5rem;
}
.login-preprod-link-emphasis {
  font-size: var(--fs-14);
  font-weight: var(--fw-bold);
  color: var(--c-gray-600);
  text-decoration: underline;
  line-height: 1.35;
}
.login-preprod-link-emphasis:hover {
  color: var(--c-gray-800);
  text-decoration: underline;
}

/* Modal succès — demande de réinitialisation (Mailjet) */
body.login-shell.login-shell--password-reset-modal-open {
  overflow: hidden;
}

.ccom-password-reset-modal-overlay[hidden] {
  display: none !important;
}

.ccom-password-reset-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  background-color: rgba(0, 33, 41, 0.45);
}

.ccom-password-reset-modal {
  width: 100%;
  max-width: 28rem;
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 33, 41, 0.18);
  color: #002129;
  outline: none;
}

.ccom-password-reset-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.ccom-password-reset-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: #002129;
}

.ccom-password-reset-modal__close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: #002129;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.ccom-password-reset-modal__close:hover {
  background-color: rgba(0, 33, 41, 0.06);
}

.ccom-password-reset-modal__close:focus-visible {
  outline: 2px solid #002129;
  outline-offset: 2px;
}

.ccom-password-reset-modal__body {
  padding: 1.25rem 1.25rem 1.5rem;
}

.ccom-password-reset-modal__headline {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: #002129;
}

.ccom-password-reset-modal__text {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  color: #002129;
}

.ccom-password-reset-modal__footer {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
}

.ccom-password-reset-modal__btn {
  margin: 0;
  padding: 0.5rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #002129;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.ccom-password-reset-modal__btn:hover {
  background-color: #f9fafb;
}

.ccom-password-reset-modal__btn:focus-visible {
  outline: 2px solid #002129;
  outline-offset: 2px;
}
