/* form.ipatlas.fr — Pages auth (login, register, étudiant) · aligné landing redesign */

:root {
  --auth-white: #ffffff;
  --auth-border: #e8e8e8;
  --auth-border-input: #d1d5db;
  --auth-text: #1a1a1a;
  --auth-text-muted: #6b7280;
  --auth-placeholder: #9ca3af;
  --auth-green: #0f6e56;
  --auth-green-hover: #0a5a45;
  --auth-green-soft: #ebf4f1;
  --auth-green-line: #d1e8e2;
  --auth-radius: 8px;
  --auth-shadow-card: 0 1px 4px rgba(0, 0, 0, 0.06);
  --auth-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --auth-focus-ring: 0 0 0 3px rgba(15, 110, 86, 0.1);
}

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

html {
  height: 100%;
}

body.auth-page {
  font-family: var(--auth-font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--auth-text);
  background: var(--auth-white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.auth-page[data-page] {
  margin-left: 0 !important;
}

.auth-page .fi-sidebar {
  display: none !important;
}

a {
  color: var(--auth-green);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--auth-green);
  outline-offset: 2px;
}

/* —— Layout deux colonnes —— */
.auth-layout {
  --auth-aside-ratio: 66.6667%;
  min-height: 100vh;
  position: relative;
}

.auth-aside {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 56px) clamp(28px, 4vw, 48px);
  overflow: hidden;
  background: var(--auth-green);
  border-right: 1px solid rgba(15, 110, 86, 0.35);
}

/* Hero bureau clinique — photo native + filtre vert charte */
.auth-aside-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-aside-bg {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}

.auth-aside-bg--photo {
  background-image: url("../sources/auth-login-hero-bg.png");
  background-size: cover;
  background-position: 52% center;
  filter: saturate(1.05) brightness(0.94);
}

.auth-aside-bg--veil {
  background:
    linear-gradient(
      155deg,
      rgba(15, 110, 86, 0.62) 0%,
      rgba(10, 90, 69, 0.54) 48%,
      rgba(29, 158, 117, 0.48) 100%
    ),
    radial-gradient(ellipse 90% 70% at 12% 28%, rgba(255, 255, 255, 0.08) 0%, transparent 52%);
  mix-blend-mode: multiply;
}

.auth-aside > .auth-brand,
.auth-aside > .auth-tagline {
  position: relative;
  z-index: 2;
}

.auth-aside .auth-brand {
  color: #ffffff;
}

.auth-aside .auth-brand:hover {
  color: #e8f7f2;
  text-decoration: none;
}

.auth-aside .auth-brand-form {
  color: #d4efe6;
}

.auth-aside .auth-brand-sep {
  color: rgba(255, 255, 255, 0.55);
}

.auth-aside .auth-brand-ipatlas {
  color: #ffffff;
}

.auth-aside .auth-tagline {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.12);
}

.auth-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--auth-text);
}

.auth-brand:hover {
  text-decoration: none;
  color: var(--auth-green);
}

.auth-brand-form {
  color: var(--auth-green);
}

.auth-brand-sep {
  color: var(--auth-text-muted);
  font-weight: 400;
}

.auth-brand-ipatlas {
  color: var(--auth-text);
}

.auth-tagline {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--auth-text-muted);
  max-width: 22rem;
}

.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 3vw, 40px) clamp(20px, 3vw, 32px);
  background: var(--auth-white);
}

.auth-main-inner {
  width: 100%;
  max-width: min(100%, 380px);
  margin: 0 auto;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--auth-text-muted);
  margin-bottom: 24px;
  text-decoration: none;
  font-weight: 500;
}

.auth-back:hover {
  color: var(--auth-green);
  text-decoration: none;
}

.auth-card h1 {
  font-size: clamp(1.5rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--auth-text);
  margin-bottom: 8px;
}

.auth-lead {
  font-size: 14px;
  color: var(--auth-text-muted);
  margin-bottom: 24px;
  line-height: 1.55;
}

/* —— Messages —— */
.auth-page .error,
.auth-page .success,
.auth-page #login-message:not(.hidden),
.auth-page #register-message:not(.hidden),
.auth-page #reset-message:not(.hidden),
.auth-page #student-message:not(.hidden) {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--auth-radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-page .error,
.auth-page #student-message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.auth-page .error::before,
.auth-page #student-message.error::before {
  content: "⚠";
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.4;
}

.auth-page .success,
.auth-page #student-message.success {
  background: var(--auth-green-soft);
  border: 1px solid var(--auth-green-line);
  color: var(--auth-green);
}

.auth-email-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #b45309;
}

.hidden {
  display: none !important;
}

/* —— Formulaire —— */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--auth-text-muted);
  margin: 4px 0 -6px;
}

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

/* .auth-field / .auth-grid-2 imposent display — sans ça [hidden] est ignoré */
.auth-page .auth-field[hidden],
.auth-page .auth-grid-2[hidden],
.auth-page [data-profile-group][hidden] {
  display: none !important;
}

.auth-field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.auth-field-hint {
  font-size: 12px;
  color: var(--auth-text-muted);
  margin-top: -2px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap input {
  padding-right: 44px;
}

.auth-input-wrap.is-valid input {
  padding-right: 68px;
}

.auth-input-wrap input,
.auth-form input:not([type="checkbox"]):not([type="radio"]),
.auth-form select {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--auth-font);
  font-size: 14px;
  color: var(--auth-text);
  background: var(--auth-white);
  border: 1px solid var(--auth-border-input);
  border-radius: var(--auth-radius);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.auth-form input::placeholder {
  color: var(--auth-placeholder);
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--auth-green);
  box-shadow: var(--auth-focus-ring);
  outline: none;
}

.auth-pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--auth-text-muted);
  cursor: pointer;
  border-radius: 6px;
  pointer-events: auto;
}

.auth-pw-toggle:hover {
  color: var(--auth-green);
  background: var(--auth-green-soft);
}

.auth-pw-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-field-check {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-green);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
}

.auth-input-wrap.is-valid .auth-field-check {
  opacity: 1;
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.auth-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* Force mot de passe */
.auth-pw-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.auth-pw-strength span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background 0.15s ease;
}

.auth-pw-strength[data-level="1"] span:nth-child(1) {
  background: #dc2626;
}
.auth-pw-strength[data-level="2"] span:nth-child(-n + 2) {
  background: #d97706;
}
.auth-pw-strength[data-level="3"] span:nth-child(-n + 3) {
  background: var(--auth-green);
}
.auth-pw-strength[data-level="4"] span {
  background: var(--auth-green);
}

.auth-pw-strength-label {
  font-size: 11px;
  color: var(--auth-text-muted);
  margin-top: 4px;
}

/* Checkbox */
.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--auth-text-muted);
  line-height: 1.5;
}

.auth-checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--auth-green);
}

.auth-check-error,
.auth-field-error {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: #dc2626;
  line-height: 1.4;
}

.auth-check-error {
  margin: -4px 0 12px 28px;
}

.auth-check-error.hidden,
.auth-field-error.hidden {
  display: none;
}

.auth-forgot-row {
  text-align: right;
  margin: -6px 0 0;
  font-size: 13px;
}

.auth-forgot-row a {
  color: var(--auth-text-muted);
  font-weight: 400;
}

.auth-forgot-row a:hover {
  color: var(--auth-green);
}

/* Bouton CTA */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  margin-top: 4px;
  font-family: var(--auth-font);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #138564 0%, var(--auth-green) 55%, #0d634c 100%);
  border: 1px solid #0a4d3c;
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #0f6e56 0%, var(--auth-green-hover) 100%);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-cta-note {
  font-size: 12px;
  color: var(--auth-text-muted);
  text-align: center;
  margin-top: -8px;
}

.auth-footer-links {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--auth-border);
  font-size: 14px;
  color: var(--auth-text-muted);
  text-align: center;
}

.auth-footer-links p + p {
  margin-top: 10px;
}

.auth-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 4px;
  font-size: 12px;
  color: var(--auth-text-muted);
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

.auth-legal {
  font-size: 12px;
  color: var(--auth-text-muted);
  line-height: 1.5;
  margin-top: 12px;
}

.auth-legal a {
  font-weight: 500;
}

/* Mobile */
@media (max-width: 900px) {
  .auth-main input,
  .auth-main select,
  .auth-main textarea {
    font-size: 16px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    display: none;
  }

  .auth-main {
    padding: 24px 20px 40px;
  }

  .auth-mobile-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
  }

  .auth-grid-2,
  .auth-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  .auth-mobile-brand {
    display: none;
  }

  /* Image fixe à gauche · formulaire qui défile par-dessus */
  .auth-aside {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--auth-aside-ratio);
    height: 100vh;
    z-index: 0;
  }

  .auth-main {
    margin-left: var(--auth-aside-ratio);
    width: calc(100% - var(--auth-aside-ratio));
    min-height: 100vh;
    position: relative;
    z-index: 1;
    box-shadow: -20px 0 48px rgba(0, 0, 0, 0.08);
  }
}
