/**
 * Auth modal — aligné sur style.css (gris vitrine + glassmorphism)
 */
@font-face {
  font-family: "Gendy";
  src: url("../fonts/Gendy.otf") format("opentype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --auth-bg: #17191e;
  --auth-bg-soft: #1b1e24;
  --auth-bg-deep: #101216;
  --auth-panel: rgba(27, 30, 36, 0.92);
  --auth-panel-soft: rgba(255, 255, 255, 0.055);
  --auth-border: rgba(255, 255, 255, 0.12);
  --auth-border-soft: rgba(255, 255, 255, 0.08);
  --auth-text: #ffffff;
  --auth-muted: rgba(255, 255, 255, 0.62);
  --auth-faint: rgba(255, 255, 255, 0.45);
  --auth-accent: rgba(255, 255, 255, 0.92);
  --auth-accent-hover: #ffffff;
  --auth-green: #4ade80;
  --auth-green-hover: #22c55e;
  --auth-radius-sm: 10px;
  --auth-radius-md: 14px;
  --auth-radius-lg: 24px;
  --auth-radius-pill: 999px;
  --auth-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(16, 18, 22, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  user-select: none;
}

.auth-modal-overlay[hidden] {
  display: none !important;
}

.auth-modal {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 920px;
  height: auto;
  max-height: calc(100dvh - 32px);
  margin: auto;
  flex: 0 0 auto;
  align-self: center;
  overflow: hidden;
  border-radius: var(--auth-radius-lg);
  border: 1px solid var(--auth-border);
  background: linear-gradient(165deg, rgba(33, 36, 44, 0.97) 0%, rgba(23, 25, 30, 0.98) 48%, rgba(20, 22, 27, 0.99) 100%);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--auth-text);
  font-family: "Poppins", ui-sans-serif, system-ui, sans-serif;
}

.auth-modal__form-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 30px 16px;
  min-height: 0;
  overflow: visible;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 42%);
}

.auth-modal__form-scroll {
  flex: 0 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-modal__brand-side {
  display: none;
  position: relative;
  width: 42%;
  flex-shrink: 0;
  padding: 36px 28px;
  border-left: 1px solid var(--auth-border-soft);
  background: linear-gradient(180deg, #1c1e24 0%, #16181d 100%);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.auth-modal__brand-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(80% 55% at 50% -8%, rgba(255, 255, 255, 0.07), transparent 65%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(255, 255, 255, 0.04), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 22px 22px;
  background-position: center, center, 0 0;
}

.auth-modal__brand-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  width: 100%;
  max-width: 320px;
}

.auth-modal__logo {
  width: min(100%, 280px);
  max-width: 280px;
  height: auto;
  opacity: 0.95;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.auth-modal__brand-name {
  margin: 0;
  font-family: "Gendy", "Holgada", ui-sans-serif, sans-serif;
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--auth-text);
  line-height: 1.15;
}

.auth-modal__brand-tagline {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--auth-faint);
  max-width: 26ch;
}

@media (min-width: 768px) {
  .auth-modal__brand-side {
    display: flex;
  }
}

.auth-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--auth-border-soft);
  border-radius: var(--auth-radius-sm);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.auth-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--auth-border);
  color: #fff;
}

.auth-modal h2 {
  margin: 0 0 4px;
  font-family: "Gendy", "Holgada", ui-sans-serif, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.auth-modal .subtitle {
  color: var(--auth-muted);
  font-size: 0.84rem;
  margin: 0 0 14px;
  line-height: 1.4;
}

.auth-tabs {
  position: relative;
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  flex-shrink: 0;
  padding: 4px;
  border-radius: var(--auth-radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--auth-border-soft);
}

.auth-tabs__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: var(--auth-radius-pill);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  z-index: 0;
}

.auth-tabs.is-signup .auth-tabs__indicator {
  transform: translateX(100%);
}

.auth-tab {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--auth-radius-pill);
  background: transparent;
  color: var(--auth-faint);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: color 0.25s ease;
}

.auth-tab:hover:not(.active) {
  color: var(--auth-muted);
}

.auth-tab.active {
  color: var(--auth-text);
}

.auth-views {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
}

.auth-view[hidden] {
  display: none !important;
}

.auth-views.is-forgot .auth-view:not(.auth-view--forgot) {
  display: none !important;
}

.auth-view--forgot {
  width: 100%;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.auth-view--forgot[hidden] {
  display: none !important;
}

.auth-views.is-forgot .auth-view--forgot {
  display: block !important;
  opacity: 1;
  visibility: visible;
}

.auth-social-block {
  margin-top: 10px;
}

/* Sign up — contenu plus compact pour tenir sans scroll interne */
#authViewSignup .auth-form {
  gap: 8px;
}

#authViewSignup .auth-form .input {
  padding: 9px 12px;
}

#authViewSignup .auth-switch {
  margin: 6px 0 0;
}

#authViewSignup .auth-social-block {
  margin-top: 8px;
}

#authViewSignup .auth-divider {
  margin: 2px 0 6px;
}

#authViewSignup .auth-social button {
  min-height: 38px;
  padding: 6px 8px;
}

.auth-modal--signup .subtitle {
  margin-bottom: 10px;
}

.auth-modal--signup .auth-tabs {
  margin-bottom: 10px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  display: grid;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--auth-faint);
}

.auth-form .input {
  width: 100%;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--auth-border-soft);
  border-radius: var(--auth-radius-md);
  color: var(--auth-text);
  padding: 10px 14px;
  font-size: 0.9rem;
  font: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-form .input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.auth-form .input:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
}

.auth-form .input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.auth-form .input.is-invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.auth-form .input.is-valid {
  border-color: rgba(74, 222, 128, 0.45);
}

.auth-field-error {
  color: #fca5a5;
  font-size: 0.82rem;
}

.auth-password-wrap {
  display: grid;
  gap: 5px;
}

.auth-password-wrap__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-password-wrap__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--auth-faint);
}

.auth-forgot-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--auth-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.auth-forgot-btn:hover {
  color: var(--auth-accent-hover);
}

.auth-input-password {
  position: relative;
}

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

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.2s ease, background 0.2s ease;
}

.auth-password-toggle:hover {
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.08);
}

.auth-password-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.auth-password-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.auth-password-toggle__icon svg {
  width: 20px;
  height: 20px;
}

.auth-password-toggle__icon[hidden] {
  display: none !important;
}

.password-strength {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.password-strength span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.2s, background 0.2s;
}

.auth-divider {
  text-align: center;
  color: var(--auth-faint);
  font-size: 0.76rem;
  margin: 4px 0 8px;
  letter-spacing: 0.02em;
}

.auth-social {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.auth-social button {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 42px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--auth-border-soft);
  border-radius: var(--auth-radius-md);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.auth-social button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.auth-social button svg {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  opacity: 0.9;
}

.auth-social button span {
  line-height: 1.2;
  text-align: left;
  font-size: 0.68rem;
  min-width: 0;
  color: var(--auth-muted);
}

.auth-switch {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.84rem;
  color: var(--auth-muted);
}

.auth-switch button {
  background: none;
  border: none;
  color: var(--auth-text);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-switch button:hover {
  color: var(--auth-accent-hover);
}

.auth-modal__form-footer {
  flex-shrink: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--auth-border-soft);
}

.auth-legal {
  margin: 0;
  padding: 0;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--auth-faint);
  text-align: center;
}

.auth-legal a {
  color: var(--auth-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-legal a:hover {
  color: var(--auth-text);
}

.btn-auth {
  width: 100%;
  margin-top: 4px;
  border-radius: var(--auth-radius-pill);
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(255, 255, 255, 0.9);
  font-weight: 600;
  padding: 12px 20px;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-auth:hover {
  background: rgba(255, 255, 255, 0.94);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(255, 255, 255, 0.1);
}

.btn-auth .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* Étape vérification e-mail — modal compact */
.auth-modal--verify {
  max-width: 480px;
}

.auth-modal--verify .auth-modal__brand-side {
  display: none !important;
}

.auth-modal--verify .auth-modal__form-side {
  padding-bottom: 18px;
}

.auth-modal--verify .subtitle {
  margin-bottom: 10px;
}

.auth-modal--verify .auth-modal__form-footer {
  margin-top: 10px;
  padding-top: 10px;
}

.auth-verify-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-view--verify .auth-verify-lead {
  margin: 0 0 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--auth-muted);
  text-align: center;
}

.auth-view--verify .auth-verify-lead strong {
  display: inline-block;
  margin-top: 4px;
  color: var(--auth-text);
  font-weight: 600;
  word-break: break-all;
}

.auth-verify-dev {
  margin: 0 0 12px;
  font-size: 0.76rem;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: var(--auth-accent-hover, #86efac);
}

.auth-form--verify {
  gap: 8px;
  margin-bottom: 4px;
}

.auth-code-label {
  display: block;
  font-size: 0.72rem;
  color: var(--auth-faint);
  margin-bottom: 6px;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-code-input {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  font-variant-numeric: tabular-nums;
  padding: 12px 14px 12px 0.35em;
}

.auth-form--verify .btn-auth {
  margin-top: 4px;
}

.auth-trust-device {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--auth-muted);
}

.auth-trust-device input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--auth-green, #4ade80);
}

.auth-verify-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--auth-border-soft);
}

.auth-verify-action {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--auth-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-verify-action:hover:not(:disabled) {
  color: var(--auth-accent-hover, #86efac);
}

.auth-verify-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}

@media (max-width: 767px) {
  .auth-modal-overlay {
    padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    align-items: flex-end;
  }

  .auth-modal {
    flex-direction: column;
    max-height: min(94dvh, calc(100dvh - 16px));
    border-radius: 18px 18px 12px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-modal__form-side {
    padding: 22px 20px 14px;
    overflow-y: auto;
    max-height: min(94dvh, calc(100dvh - 16px));
  }

  .auth-modal__close {
    background: rgba(23, 25, 30, 0.85);
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
  }

  .auth-form input[type="email"],
  .auth-form input[type="password"],
  .auth-form input[type="text"] {
    font-size: 16px;
  }
}

/* Nav — avatar dans le bouton Projects */
.nav-auth-btn--logged {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding-left: 8px !important;
}

.nav-auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
