/* ============================================================
   Elvest brand override — split-screen "comme le realm master"
   Cadre rouge PLEIN à gauche (brand) + formulaire à droite.
   Inputs + bouton repris du design system Elvest (Claude Design
   "NEW DIST" — écran "Création investisseur") : inputs ENCADRÉS
   (angles légèrement arrondis, fond écru) + bouton primaire
   Terre de Sienne (radius 4px).
   Charge ce fichier APRÈS dist/index.css.
   ============================================================ */

@font-face {
  font-family: 'PP Hatton';
  src: url('./fonts/PPHatton-Ultralight.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette alignée sur les tokens du design system Elvest */
  --elvest-terre-sienne: #ae3a28;
  --elvest-terre-sienne-dark: #8B2E20;
  --elvest-terre-sienne-muted: #EDD4D0;
  --elvest-ecru: #f7f1e2;
  --elvest-sable: #C9A864;
  --elvest-ocre: #B8883B;
  --elvest-olive: #7A7B52;
  --elvest-ardoise: #5D6B65;
  --elvest-ardoise-light: #B8BFB9;
  --elvest-charbon: #1A1C18;
  --elvest-hairline: #E8E8E6;
  --elvest-muted: #8C8C86;
  --elvest-input-bg: #F9F5EC;

  --elvest-font-display: 'PP Hatton', Georgia, serif;
  --elvest-font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === Base typographique === */
html,
body {
  font-family: var(--elvest-font-body) !important;
  color: var(--elvest-charbon);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2 {
  font-family: var(--elvest-font-display) !important;
  font-weight: 200;
  letter-spacing: -0.01em;
}

/* === Body : grid split-screen (brand gauche / form droite) === */
body.bg-secondary-100 {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  align-items: stretch !important;
  background-color: var(--elvest-ecru) !important;
  background-image: none !important;
  min-height: 100vh;
  margin: 0 !important;
  margin-top: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}

/* === Bloc gauche : cadre rouge plein (brand) === */
.elvest-split-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 64px 56px;
  color: var(--elvest-ecru);
  background-color: var(--elvest-terre-sienne);
  overflow: hidden;
}

.elvest-split-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/pattern-field.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.06;
  pointer-events: none;
}

.elvest-split-brand-logo-link {
  position: relative;
  z-index: 1;
  display: inline-block;
  align-self: flex-start;
}

.elvest-split-brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.elvest-split-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin-top: auto;
  margin-bottom: auto;
}

.elvest-split-tagline {
  font-family: var(--elvest-font-display);
  font-weight: 200;
  font-size: clamp(2.5rem, 4vw, 3.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
  color: var(--elvest-ecru);
  white-space: pre-line;
}

.elvest-split-subtitle {
  font-family: var(--elvest-font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  opacity: 0.85;
  color: var(--elvest-ecru);
}

/* === Bloc droite : formulaire (fond écru, carte centrée) === */
.elvest-split-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 32px;
  background-color: var(--elvest-ecru);
  overflow-y: auto;
  max-height: 100vh;
}

.elvest-split-form .max-w-md {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 440px;
  width: 100%;
}

/* === Responsive : empilage vertical sous 960px (brand en haut) === */
@media (max-width: 960px) {
  body.bg-secondary-100 {
    display: flex !important;
    flex-direction: column !important;
    overflow: auto;
  }

  .elvest-split-brand {
    padding: 40px 32px;
    min-height: 220px;
    order: 1;
  }

  .elvest-split-form {
    padding: 32px 20px;
    max-height: none;
    order: 2;
  }

  .elvest-split-tagline {
    font-size: 2rem;
  }
}

/* === Carte de login === */
.elvest-split-form .bg-white {
  max-width: 440px;
  width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 40px 40px !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(26, 28, 24, 0.06), 0 8px 24px rgba(26, 28, 24, 0.10) !important;
}

/* === Couleurs primaires (pour les écrans hérités : reset, OTP…) === */
.bg-primary-600 {
  background-color: var(--elvest-terre-sienne) !important;
}

.hover\:bg-primary-700:hover {
  background-color: var(--elvest-terre-sienne-dark) !important;
}

.text-primary-600 {
  color: var(--elvest-terre-sienne) !important;
}

.hover\:text-primary-500:hover {
  color: var(--elvest-terre-sienne-dark) !important;
}

.focus\:ring-primary-600:focus,
.focus\:ring-primary-200:focus {
  --tw-ring-color: rgba(174, 58, 40, 0.35) !important;
}

.focus\:border-primary-300:focus {
  border-color: var(--elvest-terre-sienne) !important;
}

[type='checkbox'],
[type='radio'] {
  color: var(--elvest-terre-sienne) !important;
}

[type='checkbox']:focus,
[type='radio']:focus {
  --tw-ring-color: rgba(174, 58, 40, 0.35) !important;
}

/* ============================================================
   Bloc de login — carte + en-tête repris du realm master
   ============================================================ */

/* === En-tête de carte === */
.elvest-card-header {
  margin-bottom: 8px;
}

.elvest-card-eyebrow {
  font-family: var(--elvest-font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--elvest-terre-sienne);
  margin: 0 0 12px;
}

.elvest-card-title {
  font-family: var(--elvest-font-display) !important;
  font-weight: 200;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--elvest-charbon);
  margin: 0 0 8px;
  text-align: left;
}

.elvest-card-subtitle {
  font-family: var(--elvest-font-body);
  font-size: 0.9375rem;
  color: var(--elvest-muted);
  margin: 0;
}

/* === Identifiant repris + relance du parcours (icône) === */
.elvest-attempted-username {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Une adresse e-mail longue doit se replier, pas pousser l'icône hors de la carte. */
.elvest-attempted-username-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.elvest-restart-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--elvest-muted);
  transition: color 0.12s ease, background-color 0.12s ease;
}

.elvest-restart-login:hover {
  color: var(--elvest-terre-sienne);
  background-color: rgba(174, 58, 40, 0.08);
}

/* L'atome arrow-path est dimensionné en h-5 w-5 : trop gros à cette échelle. */
.elvest-restart-login svg {
  width: 16px;
  height: 16px;
}

/* ============================================================
   Inputs + bouton — design system Elvest (écran Création investisseur)
   Inputs ENCADRÉS (fond écru, angles légèrement arrondis 4px)
   + bouton primaire Terre de Sienne (radius 4px).
   ============================================================ */

.elvest-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.elvest-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.elvest-label {
  font-family: var(--elvest-font-body);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--elvest-muted);
  letter-spacing: 0;
}

.elvest-input {
  width: 100%;
  height: 44px;
  padding: 12px 16px;
  font-family: var(--elvest-font-body);
  font-size: 1rem;
  color: var(--elvest-charbon);
  background-color: var(--elvest-input-bg);
  border: 1px solid var(--elvest-hairline);
  border-radius: 4px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.elvest-input::placeholder {
  color: var(--elvest-muted);
}

.elvest-input:hover {
  border-color: var(--elvest-ardoise);
}

.elvest-input:focus {
  outline: none;
  border-color: var(--elvest-terre-sienne);
  box-shadow: 0 0 0 3px rgba(174, 58, 40, 0.14);
}

.elvest-input.is-invalid {
  border-color: var(--elvest-terre-sienne);
}

.elvest-field-error {
  font-size: 0.8125rem;
  color: var(--elvest-terre-sienne);
  margin: 0;
}

.elvest-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.875rem;
}

.elvest-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--elvest-muted);
  cursor: pointer;
  user-select: none;
}

.elvest-checkbox input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--elvest-hairline);
  border-radius: 3px;
  background-color: var(--elvest-input-bg);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.elvest-checkbox input[type='checkbox']:checked {
  background-color: var(--elvest-terre-sienne);
  border-color: var(--elvest-terre-sienne);
}

.elvest-checkbox input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* === Bouton primaire — .el-btn--primary du design system === */
.elvest-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 22px;
  font-family: var(--elvest-font-body);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.elvest-button-primary {
  background-color: var(--elvest-terre-sienne);
  color: var(--elvest-ecru);
}

.elvest-button-primary:hover {
  background-color: var(--elvest-terre-sienne-dark);
}

/* Reprend le variant `outline` de lib-common (portail, Chakra v3) : bordure
   teintée de la marque, puis remplissage plein + texte inversé au survol.
   cf. common/lib-common/src/themes/chakra-ui/recipes/button.recipe.ts */
.elvest-button-secondary {
  background-color: transparent;
  color: var(--elvest-terre-sienne);
  border-color: var(--elvest-terre-sienne-muted);
}

.elvest-button-secondary:hover {
  background-color: var(--elvest-terre-sienne);
  color: var(--elvest-ecru);
  border-color: var(--elvest-terre-sienne);
}

.elvest-button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.elvest-back-link {
  margin-top: 14px;
  text-align: center;
}

/* === Bouton « Renvoyer le code » (2FA e-mail et SMS) ===
   .elvest-button pose déjà gap: 8px ; index.css ajoute une marge
   sur le seul bouton SMS, ce qui désalignait les deux écrans. */
.elvest-button .kc-resend-icon {
  display: inline-flex;
  margin-right: 0 !important;
}

.elvest-button .kc-resend-icon svg {
  width: 16px;
  height: 16px;
}

/* === Radio (écrans hérités thémés) === */
.elvest-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--elvest-charbon);
  cursor: pointer;
  user-select: none;
  font-size: 0.9375rem;
}

.elvest-radio input[type='radio'] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--elvest-hairline);
  border-radius: 50%;
  background-color: var(--elvest-input-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.2s ease;
}

.elvest-radio input[type='radio']:checked {
  border-color: var(--elvest-terre-sienne);
}

.elvest-radio input[type='radio']:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background-color: var(--elvest-terre-sienne);
}

/* === Séparateur === */
.elvest-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--elvest-muted);
}

.elvest-divider::before,
.elvest-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--elvest-hairline);
}

/* === Fournisseurs d'identité === */
.elvest-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.elvest-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background-color: var(--elvest-input-bg);
  color: var(--elvest-charbon);
  border: 1px solid var(--elvest-hairline);
  border-radius: 4px;
  font-family: var(--elvest-font-body);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.elvest-provider:hover {
  border-color: var(--elvest-charbon);
  text-decoration: none;
}

/* === Alertes === */
.elvest-alert {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.elvest-alert-error {
  background-color: rgba(174, 58, 40, 0.08);
  border-left-color: var(--elvest-terre-sienne);
  color: var(--elvest-terre-sienne-dark);
}

.elvest-alert-success {
  background-color: rgba(80, 148, 106, 0.12);
  border-left-color: #50946A;
  color: #3F7A55;
}

.elvest-alert-warning {
  background-color: rgba(184, 148, 61, 0.15);
  border-left-color: var(--elvest-ocre);
  color: #8A6300;
}

.elvest-alert-info {
  background-color: rgba(31, 114, 184, 0.10);
  border-left-color: #1F72B8;
  color: #1B3A6B;
}

/* === Pied de carte === */
.elvest-card-footer {
  margin-top: 4px;
  padding-top: 24px;
  border-top: 1px solid var(--elvest-hairline);
  text-align: center;
  font-size: 0.875rem;
  color: var(--elvest-muted);
}

/* === Liens === */
a {
  color: var(--elvest-terre-sienne);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--elvest-terre-sienne-dark);
}

/* === Texte secondaire (écrans hérités) === */
.text-secondary-600 {
  color: var(--elvest-ardoise) !important;
}
