/* =========================================================
   FAF CONNECT - PAGE DE CONNEXION
   ========================================================= */


/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {
  --faf-green: #008a4b;
  --faf-green-light: #00a65a;
  --faf-green-dark: #006b3c;
  --faf-green-darker: #004b35;

  --faf-white: #ffffff;
  --faf-background: #003d34;

  --faf-text: #263747;
  --faf-text-muted: #9ca4af;
  --faf-border: #d8dce1;
  --faf-error: #c72f2f;

  --faf-card-radius: 18px;
  --faf-field-radius: 10px;
  --faf-button-radius: 10px;

  --faf-transition: 180ms ease;
}


/* =========================================================
   2. RESET
   ========================================================= */

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

html {
  width: 100%;
  min-width: 320px;
  height: 100%;
}

body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;

  font-family:
    Inter,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  color: var(--faf-text);
  background: var(--faf-background);
}

button,
input {
  font: inherit;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}


/* =========================================================
   3. PAGE PRINCIPALE — DESKTOP
   ========================================================= */

.faf-login-page {
  position: relative;

  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 16px 24px;

  overflow: hidden;

  background-color: var(--faf-background);

  background-image:
    linear-gradient(180deg,
      rgba(0, 31, 29, 0.08) 0%,
      rgba(0, 45, 37, 0.03) 55%,
      rgba(0, 24, 22, 0.08) 100%),
    url("../images/login-desktop-bg.jpg");

  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.faf-login-page::before {
  content: "";

  position: fixed;
  inset: 0;

  pointer-events: none;

  background:
    radial-gradient(circle at 50% 30%,
      rgba(0, 122, 83, 0.04),
      rgba(0, 31, 29, 0.01) 55%,
      rgba(0, 20, 18, 0.08) 100%);
}


/* =========================================================
   4. CONTENEUR PRINCIPAL
   ========================================================= */

.faf-login-container {
  position: relative;
  z-index: 1;

  width: min(100%, 560px);

  display: flex;
  flex-direction: column;
  align-items: center;
}


/* =========================================================
   5. IDENTITÉ VISUELLE
   ========================================================= */

.faf-brand {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;

  margin-bottom: 12px;

  text-align: center;
}

.faf-main-logo {
  display: block;

  width: 68px;
  height: 68px;

  margin: 0 0 10px;

  object-fit: contain;

  filter:
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.16));
}

.faf-connect-brand {
  width: 100%;
  min-height: 36px;

  display: flex;
  justify-content: center;
  align-items: center;
}

.faf-connect-logo {
  display: block;

  width: min(47%, 285px);
  height: auto;

  object-fit: contain;
}

.faf-federation-name {
  margin-bottom: 10px;

  color: var(--faf-white);

  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;

  letter-spacing: 2.4px;
  text-transform: uppercase;

  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   6. CARTE DE CONNEXION
   ========================================================= */

.faf-login-card {
  position: relative;
  width: 70%;

  padding: 20px 42px 30px;

  background: rgba(255, 255, 255, 0.985);

  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--faf-card-radius);

  box-shadow:
    0 18px 45px rgba(0, 20, 20, 0.17),
    0 4px 12px rgba(0, 20, 20, 0.07);

  animation: fafCardEntrance 450ms ease-out both;
}

.faf-login-title {
  margin: 0 0 24px;

  color: var(--faf-green-dark);

  font-size: 30px;
  font-weight: 750;
  line-height: 1.15;

  text-align: center;
  letter-spacing: -0.7px;
}


/* =========================================================
   7. FORMULAIRE
   ========================================================= */

.faf-login-form {
  padding-top: 18px;
  width: 100%;
}

.faf-form-group {
  width: 100%;
  margin-bottom: 14px;
}

.faf-input-wrapper {
  position: relative;

  width: 100%;
  height: 62px;

  display: flex;
  align-items: center;

  background: rgba(255, 255, 255, 0.92);

  border: 1.5px solid var(--faf-border);
  border-radius: var(--faf-field-radius);

  transition:
    border-color var(--faf-transition),
    box-shadow var(--faf-transition),
    background-color var(--faf-transition);
}

.faf-input-wrapper:focus-within {
  background: var(--faf-white);

  border-color: var(--faf-green);

  box-shadow:
    0 0 0 3px rgba(0, 138, 75, 0.10);
}

.faf-input-icon {
  position: absolute;
  left: 22px;

  width: 27px;
  height: 27px;

  display: inline-flex;
  justify-content: center;
  align-items: center;

  color: #687482;

  pointer-events: none;
}

.faf-input-icon svg {
  width: 100%;
  height: 100%;
}

.faf-form-control {
  width: 100%;
  height: 100%;

  padding: 0 62px 0 68px;

  color: var(--faf-text);
  background: transparent;

  border: 0;
  outline: 0;

  font-size: 15px;
  font-weight: 500;

  border-radius: inherit;
}

.faf-form-control::placeholder {
  color: #b1b6bf;
  opacity: 1;
}

.faf-form-control:-webkit-autofill,
.faf-form-control:-webkit-autofill:hover,
.faf-form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--faf-text);

  transition:
    background-color 9999s ease-in-out 0s;
}


/* =========================================================
   8. BOUTON AFFICHER LE MOT DE PASSE
   ========================================================= */

.faf-password-toggle {
  position: absolute;
  right: 13px;

  width: 42px;
  height: 42px;

  display: inline-flex;
  justify-content: center;
  align-items: center;

  padding: 0;

  color: #687482;
  background: transparent;

  border-radius: 50%;

  cursor: pointer;

  transition:
    color var(--faf-transition),
    background-color var(--faf-transition);
}

.faf-password-toggle:hover {
  color: var(--faf-green-dark);
  background: rgba(0, 138, 75, 0.07);
}

.faf-password-toggle:focus-visible {
  outline: 3px solid rgba(0, 138, 75, 0.22);
  outline-offset: 2px;
}

.faf-eye-icon {
  width: 25px;
  height: 25px;
}

.faf-eye-closed {
  display: none;
}

.faf-password-toggle.is-visible .faf-eye-open {
  display: none;
}

.faf-password-toggle.is-visible .faf-eye-closed {
  display: block;
}


/* =========================================================
   9. MESSAGES D'ERREUR
   ========================================================= */

.faf-field-error {
  min-height: 0;
  margin: 4px 3px 0;

  color: var(--faf-error);

  font-size: 11px;
  line-height: 1.3;
}

.faf-field-error:empty {
  display: none;
}

.faf-form-group.has-error .faf-input-wrapper {
  border-color: var(--faf-error);

  box-shadow:
    0 0 0 3px rgba(199, 47, 47, 0.09);
}


/* =========================================================
   10. OPTIONS
   ========================================================= */

.faf-login-options {
  width: 100%;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 16px;

  margin: 18px 0 22px;
}

.faf-remember-label {
  display: inline-flex;
  align-items: center;

  gap: 9px;

  color: var(--faf-text);

  font-size: 13px;
  font-weight: 500;

  cursor: pointer;
  user-select: none;
}

.faf-checkbox-input {
  position: absolute;

  width: 1px;
  height: 1px;

  overflow: hidden;

  clip: rect(0 0 0 0);
  clip-path: inset(50%);

  white-space: nowrap;
}

.faf-custom-checkbox {
  flex: 0 0 auto;

  width: 21px;
  height: 21px;

  display: inline-flex;
  justify-content: center;
  align-items: center;

  color: var(--faf-white);
  background: var(--faf-white);

  border: 2px solid #cbd0d6;
  border-radius: 4px;

  transition:
    border-color var(--faf-transition),
    background-color var(--faf-transition),
    box-shadow var(--faf-transition);
}

.faf-custom-checkbox svg {
  width: 13px;
  height: 13px;

  opacity: 0;
  transform: scale(0.7);

  transition:
    opacity var(--faf-transition),
    transform var(--faf-transition);
}

.faf-checkbox-input:checked+.faf-custom-checkbox {
  background: var(--faf-green);
  border-color: var(--faf-green);
}

.faf-checkbox-input:checked+.faf-custom-checkbox svg {
  opacity: 1;
  transform: scale(1);
}

.faf-checkbox-input:focus-visible+.faf-custom-checkbox {
  box-shadow:
    0 0 0 4px rgba(0, 138, 75, 0.15);
}

.faf-forgot-password {
  color: var(--faf-green-dark);

  font-size: 13px;
  font-weight: 600;

  transition:
    color var(--faf-transition),
    opacity var(--faf-transition);
}

.faf-forgot-password:hover {
  color: var(--faf-green);
  text-decoration: underline;
}

.faf-forgot-password:focus-visible {
  outline: 3px solid rgba(0, 138, 75, 0.2);
  outline-offset: 4px;

  border-radius: 3px;
}


/* =========================================================
   11. BOUTON CONNEXION
   ========================================================= */

.faf-login-button {
  position: relative;

  width: 100%;
  height: 58px;

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 0 66px;

  color: var(--faf-white);

  background:
    linear-gradient(90deg,
      var(--faf-green-dark) 0%,
      var(--faf-green) 100%);

  border-radius: var(--faf-button-radius);

  box-shadow:
    0 8px 20px rgba(0, 107, 60, 0.16);

  cursor: pointer;
  overflow: hidden;

  transition:
    transform var(--faf-transition),
    box-shadow var(--faf-transition),
    filter var(--faf-transition);
}

.faf-login-button::before {
  content: "";

  position: absolute;
  inset: 0;

  background:
    linear-gradient(110deg,
      transparent 20%,
      rgba(255, 255, 255, 0.13) 50%,
      transparent 80%);

  transform: translateX(-110%);

  transition: transform 500ms ease;
}

.faf-login-button:hover {
  transform: translateY(-2px);

  box-shadow:
    0 12px 26px rgba(0, 107, 60, 0.22);
}

.faf-login-button:hover::before {
  transform: translateX(110%);
}

.faf-login-button:active {
  transform: translateY(0);
}

.faf-login-button:focus-visible {
  outline: 4px solid rgba(0, 166, 90, 0.25);
  outline-offset: 4px;
}

.faf-login-button:disabled {
  cursor: wait;
  opacity: 0.8;
  transform: none;
}

.faf-login-button-text {
  position: relative;
  z-index: 1;

  font-size: 18px;
  font-weight: 650;
}

.faf-login-button-icon {
  position: absolute;
  z-index: 1;
  right: 10px;

  width: 42px;
  height: 42px;

  display: inline-flex;
  justify-content: center;
  align-items: center;

  color: var(--faf-white);
  background: rgba(0, 82, 53, 0.20);

  border-radius: 50%;

  transition:
    transform var(--faf-transition),
    background-color var(--faf-transition);
}

.faf-login-button-icon svg {
  width: 25px;
  height: 25px;
}

.faf-login-button:hover .faf-login-button-icon {
  transform: translateX(3px);
  background: rgba(0, 72, 47, 0.30);
}


/* =========================================================
   12. LOADER
   ========================================================= */

.faf-login-spinner {
  position: absolute;
  z-index: 2;

  width: 25px;
  height: 25px;

  display: none;

  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--faf-white);
  border-radius: 50%;

  animation: fafSpinner 700ms linear infinite;
}

.faf-login-button.is-loading .faf-login-button-text,
.faf-login-button.is-loading .faf-login-button-icon {
  visibility: hidden;
}

.faf-login-button.is-loading .faf-login-spinner {
  display: block;
}


/* =========================================================
   13. ACCESSIBILITÉ
   ========================================================= */

.faf-visually-hidden {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;

  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;

  border: 0 !important;

  white-space: nowrap !important;
}


/* =========================================================
   14. TABLETTE
   ========================================================= */

@media (min-width: 768px) and (max-width: 900px) {

  .faf-login-page {
    padding-right: 22px;
    padding-left: 22px;
  }

  .faf-login-container {
    width: min(100%, 540px);
  }

  .faf-login-card {
    width: 90%;
    position: relative;
    padding-right: 38px;
    padding-left: 38px;
  }
}


/* =========================================================
   15. MOBILE
   ========================================================= */

@media (max-width: 767px) {

  :root {
    --faf-card-radius: 24px;
    --faf-field-radius: 12px;
    --faf-button-radius: 12px;
  }

  html,
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .faf-login-page {
    min-height: 100vh;
    min-height: 100svh;

    padding:
      max(28px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));

    align-items: flex-start;

    overflow-x: hidden;
    overflow-y: visible;

    background-image:
      linear-gradient(180deg,
        rgba(0, 37, 33, 0.04) 0%,
        rgba(0, 43, 36, 0.02) 60%,
        rgba(0, 22, 20, 0.07) 100%),
      url("../images/login-mobile-bg.jpg");

    background-position: center center;
    background-size: cover;
  }

  .faf-login-page::before {
    background:
      radial-gradient(circle at 50% 25%,
        rgba(0, 124, 79, 0.035),
        transparent 55%);
  }

  .faf-login-container {
    width: 100%;
  }

  .faf-brand {
    margin-bottom: 24px;
  }

  .faf-main-logo {
    width: 100px;
    height: 100px;

    margin-bottom: 10px;
  }

  .faf-connect-brand {
    min-height: 44px;
  }

  .faf-connect-logo {
    width: min(88%, 340px);
  }

  .faf-federation-name {
    margin-top: 8px;

    font-size: clamp(10px, 2.8vw, 13px);
    line-height: 1.45;

    letter-spacing: clamp(1.4px, 0.5vw, 2.7px);
  }

  .faf-login-card {
    position: relative;
    width: 90%;
    padding:
      clamp(34px, 7vw, 46px) clamp(22px, 5vw, 38px) clamp(32px, 6vw, 43px);

    box-shadow:
      0 20px 50px rgba(0, 22, 20, 0.18),
      0 4px 14px rgba(0, 22, 20, 0.07);
  }

  .faf-login-title {
    margin-bottom: clamp(30px, 7vw, 42px);

    font-size: clamp(28px, 7vw, 36px);
    letter-spacing: -0.7px;
  }

  .faf-form-group {
    margin-bottom: 18px;
  }

  .faf-input-wrapper {
    height: clamp(70px, 16vw, 90px);
  }

  .faf-input-icon {
    left: clamp(20px, 5vw, 28px);

    width: clamp(27px, 6vw, 34px);
    height: clamp(27px, 6vw, 34px);
  }

  .faf-form-control {
    padding-right: 65px;
    padding-left: clamp(62px, 15vw, 80px);

    font-size: clamp(17px, 4.4vw, 22px);
  }

  .faf-password-toggle {
    right: 13px;

    width: 48px;
    height: 48px;
  }

  .faf-eye-icon {
    width: clamp(26px, 6vw, 32px);
    height: clamp(26px, 6vw, 32px);
  }

  .faf-field-error {
    font-size: 12px;
  }

  .faf-login-options {
    gap: 10px;

    margin-top: 14px;
    margin-bottom: clamp(30px, 7vw, 42px);
  }

  .faf-remember-label,
  .faf-forgot-password {
    font-size: clamp(12px, 3.3vw, 16px);
  }

  .faf-remember-label {
    gap: 8px;
  }

  .faf-custom-checkbox {
    width: clamp(22px, 5.5vw, 27px);
    height: clamp(22px, 5.5vw, 27px);
  }

  .faf-login-button {
    height: clamp(66px, 16vw, 82px);

    padding-right: 70px;
    padding-left: 70px;
  }

  .faf-login-button-text {
    font-size: clamp(19px, 5vw, 24px);
  }

  .faf-login-button-icon {
    right: 12px;

    width: clamp(44px, 11vw, 55px);
    height: clamp(44px, 11vw, 55px);
  }

  .faf-login-button-icon svg {
    width: clamp(25px, 6vw, 31px);
    height: clamp(25px, 6vw, 31px);
  }
}


/* =========================================================
   16. PETITS MOBILES
   ========================================================= */

@media (max-width: 430px) {

  .faf-login-page {
    padding-right: 12px;
    padding-left: 12px;
  }

  .faf-main-logo {
    width: 88px;
    height: 88px;
  }

  .faf-connect-logo {
    width: min(90%, 300px);
  }

  .faf-login-card {
    position: relative;
    width: 90%;
    padding-right: 21px;
    padding-left: 21px;
  }

  .faf-login-options {
    align-items: center;
  }

  .faf-remember-label,
  .faf-forgot-password {
    font-size: 12px;
  }

  .faf-custom-checkbox {
    width: 21px;
    height: 21px;
  }
}


/* =========================================================
   17. MOBILES TRÈS ÉTROITS
   ========================================================= */

@media (max-width: 360px) {

  .faf-login-page {
    padding-right: 9px;
    padding-left: 9px;
  }

  .faf-main-logo {
    width: 80px;
    height: 80px;
  }

  .faf-connect-logo {
    width: min(92%, 270px);
  }

  .faf-federation-name {
    letter-spacing: 1.3px;
  }

  .faf-login-card {
    position: relative;
    width: 90%;
    padding-right: 17px;
    padding-left: 17px;
  }

  .faf-login-options {
    flex-direction: column;
    align-items: flex-start;

    gap: 13px;
  }

  .faf-login-button {
    padding-right: 62px;
    padding-left: 50px;
  }
}


/* =========================================================
   18. ANIMATIONS
   ========================================================= */

@keyframes fafCardEntrance {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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


/* =========================================================
   19. RÉDUCTION DES ANIMATIONS
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   MESSAGE DE CONNEXION
   ========================================================= */

/* الرسالة العائمة */
.faf-login-message {
  position: absolute;

  top: 68px;
  left: 42px;
  right: 42px;

  z-index: 20;

  min-height: 22px;
  padding: 2px 2px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid transparent;
  border-radius: 8px;

  font-size: 11px;
  font-weight: 600;
  line-height: 0.8;
  text-align: center;

  opacity: 1;
  visibility: visible;
}

/* عند الإخفاء */
.faf-login-message[hidden] {
  display: none;
}

.faf-login-message--loading {
  color: #475569;
  background: #f1f5f9;
  border-color: #dbe2ea;
}

.faf-login-message--success {
  color: #05603a;
  background: #eaf8f1;
  border-color: #b9e8d1;
}

.faf-login-message--error {
  color: #a92121;
  background: #fff0f0;
  border-color: #efc2c2;
}


/* Petit spinner dans le message */

.faf-inline-spinner {
  width: 14px;
  height: 14px;

  display: inline-block;

  margin-left: 7px;

  vertical-align: -2px;

  border: 2px solid rgba(71, 85, 105, 0.28);
  border-top-color: #475569;
  border-radius: 50%;

  animation: fafSpinner 700ms linear infinite;
}


/* Pied de page */

.faf-login-footer {
  width: 100%;

  margin-top: 10px;

  color: rgba(255, 255, 255, 0.82);

  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;

  text-align: center;
  letter-spacing: 0.3px;

  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}


/* Mobile */

@media (max-width: 767px) {

  .faf-login-message {
    margin-bottom: 10px;
    padding: 9px 11px;

    font-size: 12px;
  }

  .faf-login-footer {
    margin-top: 14px;
    padding: 0 10px;

    font-size: 9px;
  }
}

.grecaptcha-badge {
  position: fixed !important;
  right: -186px !important;
  bottom: 14px !important;
  width: 256px !important;
  height: 60px !important;
  overflow: hidden !important;
  z-index: 999999 !important;
  transition: right 0.3s ease !important;
  transform: none !important;
}

.grecaptcha-badge:hover,
.grecaptcha-badge:focus-within {
  right: 0 !important;
}
