/* ============================================================
   traak · Popup de connexion ReKrute
   Composant volontairement isolé du reste du site (le reste de
   l'espace candidat est en thème sombre éditorial ; cette popup
   reprend le style clair/premium demandé, façon Google). Toutes
   les classes sont préfixées rk- pour ne jamais entrer en
   collision avec account.css / styles.css.
   Couleurs : on réutilise les tokens de marque existants
   (--teal, --orange, navy) plutôt que d'imposer une palette à
   part — seul --rk-violet est propre à ce composant (pas de
   violet dans tokens.css).
   ============================================================ */

.rk-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 14, 26, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--ease-standard, ease), visibility 220ms;
}
.rk-overlay.is-open { opacity: 1; visibility: visible; }

.rk-modal {
  --rk-blue: #1677FF;
  --rk-blue-deep: #0F5FDC;
  --rk-navy: #102A56;
  --rk-violet: #7B5CFA;
  --rk-gray-text: #667085;
  --rk-border: #E4E7EC;
  --rk-pastel-bg: #EEF4FF;

  width: 100%;
  max-width: 900px;
  /* `height` (pas juste max-height) est nécessaire : sur une grille CSS,
     une piste de rangée en `auto` se dimensionne sur le contenu le plus
     grand des deux colonnes, PAS sur max-height du conteneur — c'est ce qui
     rendait la popup énorme (la grille grandissait sans limite, et
     max-height coupait juste le rendu final sans empêcher la mise en page
     de calculer une hauteur bien plus grande en interne). Une hauteur
     définie force les deux colonnes à se contenir dans cet espace et à
     scroller individuellement si besoin. */
  height: min(90vh, 580px); /* logo + illustration retirés : le contenu tient large en dessous de 620px */
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px -20px rgba(16, 42, 86, 0.35), 0 4px 18px rgba(16, 42, 86, 0.12);
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 260ms var(--ease-standard, ease), opacity 220ms;
  font-family: var(--font-ui, 'Plus Jakarta Sans', system-ui, sans-serif);
  color: var(--rk-navy);
}
.rk-overlay.is-open .rk-modal { transform: translateY(0) scale(1); opacity: 1; }

.rk-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 42, 86, 0.05);
  color: var(--rk-gray-text);
  cursor: pointer;
  transition: background 160ms, color 160ms;
}
.rk-close:hover { background: rgba(16, 42, 86, 0.1); color: var(--rk-navy); }
.rk-close svg { width: 16px; height: 16px; }

/* ── Colonne gauche : connexion ─────────────────────────────── */
.rk-col-left {
  min-height: 0; /* les enfants de grille poussent leur piste au-delà de max-height
                    sur .rk-modal sans ça — c'est ce qui rendait la popup énorme */
  padding: clamp(28px, 3.6vw, 44px) clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.rk-title {
  font-size: clamp(19px, 1.9vw, 23px);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--teal, #00D4AA);
  margin: 0 0 8px;
}
.rk-subtitle {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--rk-gray-text);
  max-width: 38ch;
  margin: 0 0 20px;
}
.rk-subtitle strong { color: var(--rk-navy); font-weight: 700; }

.rk-form { display: flex; flex-direction: column; gap: 15px; }
.rk-field { display: flex; flex-direction: column; gap: 7px; }
.rk-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rk-navy);
}
.rk-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.rk-input-wrap .rk-icon-leading {
  position: absolute;
  left: 15px;
  width: 18px;
  height: 18px;
  color: #98A2B3;
  pointer-events: none;
}
.rk-input-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 44px;
  font-family: inherit;
  font-size: 15px;
  color: var(--rk-navy);
  background: #fff;
  border: 1.5px solid var(--rk-border);
  border-radius: 12px;
  transition: border-color 160ms, box-shadow 160ms;
}
.rk-input-wrap input::placeholder { color: #A6ADBB; }
.rk-input-wrap input:focus {
  outline: none;
  border-color: var(--rk-blue);
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.12);
}
.rk-input-wrap input.rk-input--invalid { border-color: #E53E3E; }
.rk-input-wrap input[type="password"] { padding-right: 44px; }

.rk-toggle-pw {
  position: absolute;
  right: 14px;
  width: 20px;
  height: 20px;
  color: #98A2B3;
  cursor: pointer;
  background: none;
  border: 0;
  display: grid;
  place-items: center;
  padding: 0;
}
.rk-toggle-pw:hover { color: var(--rk-gray-text); }
.rk-toggle-pw svg { width: 18px; height: 18px; }

.rk-field-error {
  font-size: 12.5px;
  color: #E53E3E;
  min-height: 1px;
}

.rk-forgot { text-align: right; margin-top: -6px; }
.rk-forgot a { font-size: 13px; font-weight: 600; color: var(--rk-blue); text-decoration: none; }
.rk-forgot a:hover { text-decoration: underline; }

.rk-submit {
  position: relative;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--rk-blue) 0%, var(--rk-blue-deep) 100%);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 160ms, box-shadow 160ms, opacity 160ms;
  box-shadow: 0 8px 20px rgba(22, 119, 255, 0.28);
}
.rk-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(22, 119, 255, 0.36); }
.rk-submit:active { transform: translateY(0); }
.rk-submit svg { width: 16px; height: 16px; transition: transform 160ms; }
.rk-submit:hover svg { transform: translateX(2px); }
.rk-submit:disabled { opacity: 0.75; cursor: default; transform: none; }

.rk-spinner {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rk-spin 700ms linear infinite;
}
@keyframes rk-spin { to { transform: rotate(360deg); } }

.rk-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0 14px;
}
.rk-divider::before, .rk-divider::after { content: ""; flex: 1; height: 1px; background: var(--rk-border); }

.rk-signup { text-align: center; }
.rk-signup p { font-size: 13.5px; color: var(--rk-gray-text); margin: 0 0 4px; }
.rk-signup a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14.5px; font-weight: 700; color: var(--rk-blue); text-decoration: none;
}
.rk-signup a:hover { text-decoration: underline; }
.rk-signup a svg { width: 14px; height: 14px; }

.rk-form-error {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(229, 62, 62, 0.08);
  color: #C53030;
  font-size: 13px;
  font-weight: 500;
}
.rk-form-error.is-visible { display: flex; }
.rk-form-error svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Colonne droite : bénéfices ReKrute → Traak ─────────────── */
.rk-col-right {
  min-height: 0; /* idem .rk-col-left */
  position: relative;
  background: linear-gradient(160deg, var(--rk-pastel-bg) 0%, #F6F9FF 55%, #EAF2FF 100%);
  padding: clamp(26px, 3.2vw, 40px) clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.rk-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  pointer-events: none;
}
.rk-blob--1 { width: 180px; height: 180px; top: -60px; right: -50px; background: radial-gradient(circle, rgba(22,119,255,0.14), transparent 70%); }
.rk-blob--2 { width: 220px; height: 220px; bottom: 40px; left: -80px; background: radial-gradient(circle, rgba(0,212,170,0.12), transparent 70%); }

.rk-right-title {
  position: relative;
  font-size: clamp(19px, 1.9vw, 23px);
  font-weight: 800;
  line-height: 1.26;
  letter-spacing: -0.01em;
  color: var(--rk-navy);
  margin: 0 0 8px;
}
.rk-right-text {
  position: relative;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--rk-gray-text);
  max-width: 38ch;
  margin: 0 0 18px;
}
.rk-right-text strong { color: var(--rk-navy); font-weight: 700; }

.rk-benefits { position: relative; display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.rk-benefit { display: flex; align-items: center; gap: 12px; }
.rk-benefit-icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}
.rk-benefit-icon svg { width: 16px; height: 16px; }
.rk-benefit-icon--teal { background: var(--teal, #00D4AA); }
.rk-benefit-icon--violet { background: var(--rk-violet); }
.rk-benefit-icon--orange { background: var(--orange, #FF6B2B); }
.rk-benefit span { font-size: 13.5px; font-weight: 600; color: var(--rk-navy); }

/* ── Cartes ReKrute → traak + flèche ─────────────────────────── */
.rk-bridge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 4px 0;
}
.rk-card {
  width: 100px;
  padding: 11px 10px;
  background: #fff;
  border: 1px solid rgba(16, 42, 86, 0.08);
  border-radius: 14px;
  box-shadow: 0 10px 24px -8px rgba(16, 42, 86, 0.18);
  text-align: center;
}
.rk-card--left { transform: rotate(-6deg); }
.rk-card--right { transform: rotate(5deg); }
.rk-card .rk-card-logo { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 6px; }
.rk-card--left .rk-card-logo { color: #E4342F; }
.rk-card--right .rk-card-logo { color: var(--teal, #00D4AA); }
.rk-card .rk-card-sub { font-size: 10.5px; line-height: 1.4; color: var(--rk-gray-text); }

.rk-arrow { flex-shrink: 0; width: 46px; height: 30px; color: var(--rk-blue); opacity: 0.85; }

.rk-handwritten {
  position: relative;
  font-family: 'Caveat', cursive;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--rk-violet);
  text-align: center;
  margin: 4px 0 14px;
}

.rk-illustration-wrap {
  position: relative;
}
.rk-illustration-note {
  font-family: 'Caveat', cursive;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--rk-navy);
}
.rk-illustration-note .rk-underline {
  display: block;
  width: 84px;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--rk-violet), var(--teal, #00D4AA));
}

/* ── Responsive ──────────────────────────────────────────────────
   Colonne unique sous 860px. En dessous de 520px, on reste sur une
   vraie modale centrée avec marge tout autour (pas un bottom-sheet
   plein écran collé aux bords — ça se sentait cramped sur téléphone). */
@media (max-width: 860px) {
  .rk-modal {
    grid-template-columns: 1fr;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 22px;
  }
  .rk-col-left, .rk-col-right { overflow: visible; } /* le scroll se fait sur .rk-modal en colonne unique */
  .rk-col-right { order: 2; padding-top: 32px; }
  .rk-col-left { order: 1; }
  .rk-bridge { transform: scale(0.92); }
}

@media (max-width: 520px) {
  .rk-overlay { padding: 14px; }
  .rk-modal { max-height: 88vh; border-radius: 20px; }
  .rk-close { top: 14px; right: 14px; }
  .rk-col-left { padding: 30px 24px 26px; }
  .rk-col-right { padding: 26px 24px 28px; }
  .rk-title { font-size: 19px; padding-right: 38px; } /* laisse la place au bouton fermer */
  .rk-subtitle { margin-bottom: 22px; }
  .rk-illustration-note { font-size: 15px; }
  .rk-right-title { font-size: 20px; }
  .rk-bridge { gap: 16px; }
  .rk-card { width: 90px; padding: 10px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .rk-overlay, .rk-modal, .rk-submit, .rk-submit svg { transition: none; }
  .rk-spinner { animation: none; }
}
