/* V-Zone Cloud — Page de connexion (split layout) */
.login-page {
  --login-brand: #06c4b4;
  --login-brand-dark: #0d9488;
  --login-text: #1e293b;
  --login-muted: #64748b;
  --login-line: #e2e8f0;
  --login-card-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --login-ease: cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  min-height: min(560px, calc(100dvh - 280px));
  width: 100%;
  max-width: 100%;
  background: #fff;
  font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
}

/* Page login — pas de scroll horizontal */
html.login-page-active,
body.login-page-active {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

body.login-page-active .page-wraper {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* --- Panneau visuel gauche --- */
.login-visual {
  position: relative;
  flex: 0 0 38%;
  min-height: min(560px, calc(100dvh - 280px));
  background-color: #0c1220;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 2.25rem;
  overflow: hidden;
}

.login-visual__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #fff;
  z-index: 2;
  max-width: 100%;
}

.login-visual__logo img {
  height: 42px;
  width: auto;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.login-visual__logo span {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-visual__deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
}

.login-visual__deco svg {
  width: 100%;
  height: 100%;
}

.login-visual__badge {
  align-self: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  z-index: 2;
  flex-shrink: 0;
}

.login-visual__tagline {
  font-size: 0.875rem;
  opacity: 0.85;
  max-width: 16rem;
  line-height: 1.5;
  z-index: 2;
  margin: 0;
}

.login-visual__tagline--short {
  display: none;
}

/* --- Zone formulaire droite --- */
.login-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem 3rem 2.5rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.login-topnav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-wrap: wrap;
}

.login-topnav a {
  color: var(--login-muted);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.login-topnav a:hover {
  color: var(--login-brand-dark);
}

.login-topnav a.is-active {
  color: var(--login-brand-dark);
  border-bottom-color: #ef4444;
}

.login-heading {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--login-text);
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
}

.login-heading span {
  color: var(--login-brand);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #fff;
  border: 1px solid var(--login-line);
  border-radius: 4px;
  box-shadow: var(--login-card-shadow);
  padding: 2rem 2rem 1.75rem;
  box-sizing: border-box;
}

.login-card__icon {
  position: absolute;
  top: -18px;
  left: 1.25rem;
  width: 44px;
  height: 44px;
  background: #111827;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.login-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.login-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--login-muted);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  min-height: 46px;
  border: 1px solid var(--login-line);
  border-radius: 3px;
  font-size: 0.9375rem;
  color: var(--login-text);
  background: #fff;
  transition: border-color 0.2s var(--login-ease), box-shadow 0.2s var(--login-ease), transform 0.15s var(--login-ease);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.login-field input:focus {
  outline: none;
  border-color: var(--login-brand);
  box-shadow: 0 0 0 3px rgba(6, 196, 180, 0.15);
}

.login-field--error input {
  border-color: #ef4444;
}

.login-field__error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  line-height: 1.35;
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
}

.login-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--login-muted);
  cursor: pointer;
  min-height: 44px;
}

.login-options label input {
  width: 18px;
  height: 18px;
  accent-color: var(--login-brand);
  flex-shrink: 0;
}

.login-options a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.login-options a:hover {
  text-decoration: underline;
}

.login-submit {
  width: 100%;
  padding: 0.85rem 1rem;
  min-height: 48px;
  border: none;
  border-radius: 3px;
  background: var(--login-brand);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s var(--login-ease), transform 0.15s var(--login-ease), box-shadow 0.2s var(--login-ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.login-submit:hover {
  background: var(--login-brand-dark);
}

.login-submit:active {
  transform: scale(0.99);
}

.login-submit.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.login-2fa-intro {
  font-size: 0.9rem;
  color: var(--login-text-muted, #64748b);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.login-2fa-resend {
  background: none;
  border: none;
  padding: 0;
  color: var(--login-brand, #0d9488);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
}

.login-2fa-resend:hover { color: var(--login-brand-dark, #0f766e); }

.login-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.login-messages li {
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  word-break: break-word;
}

.login-messages li.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.login-messages li.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.login-messages li.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.login-footer-text {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--login-muted);
  text-align: center;
  line-height: 1.5;
  max-width: 640px;
  width: 100%;
}

.login-footer-text a {
  color: var(--login-brand-dark);
  font-weight: 600;
  text-decoration: none;
}

.login-footer-text a:hover {
  text-decoration: underline;
}

.login-terms {
  margin-top: 0.75rem;
  font-size: 0.6875rem;
  color: var(--login-muted);
  text-align: center;
  line-height: 1.45;
}

.login-terms a {
  color: var(--login-brand-dark);
}

@keyframes loginFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Tablette & mobile --- */
@media (max-width: 991.98px) {
  .login-page {
    flex-direction: column;
    min-height: auto;
    background: linear-gradient(180deg, #0c1220 0%, #0c1220 88px, #f1f5f9 88px, #f8fafc 100%);
  }

  .login-visual {
    flex: none;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0;
    padding: 0.85rem 1.25rem;
    padding-top: max(0.85rem, env(safe-area-inset-top));
    background-size: cover;
    background-position: center top;
  }

  .login-visual__deco,
  .login-visual__badge,
  .login-visual__tagline--full,
  .login-visual__logo {
    display: none;
  }

  .login-visual__tagline--short {
    display: block;
    max-width: 18rem;
    margin: 0 auto;
    font-size: 0.8125rem;
    line-height: 1.45;
    opacity: 0.88;
  }

  .login-main {
    flex: 1;
    padding: 1.15rem 1rem 1.75rem;
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    align-items: stretch;
    animation: loginFadeUp 0.45s var(--login-ease) both;
  }

  .login-topnav {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 1.15rem;
    padding: 0.25rem;
    gap: 0;
    justify-content: stretch;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .login-topnav a {
    flex: 1;
    justify-content: center;
    min-height: 42px;
    padding: 0.45rem 0.5rem;
    border-radius: 999px;
    border-bottom: none;
    color: var(--login-muted);
    transition: color 0.2s var(--login-ease), background 0.2s var(--login-ease), box-shadow 0.2s var(--login-ease);
  }

  .login-topnav a.is-active {
    background: #fff;
    color: var(--login-brand-dark);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  }

  .login-heading {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 1rem;
    font-size: clamp(1.25rem, 4.5vw, 1.5rem);
    text-align: center;
    line-height: 1.25;
  }

  .login-heading span {
    color: var(--login-brand);
    white-space: nowrap;
  }

  .login-card {
    margin: 0 auto;
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 1.65rem 1.25rem 1.35rem;
    padding-top: 1.75rem;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    background: #fff;
  }

  .login-card__icon {
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #111827 0%, #1e293b 100%);
  }

  .login-fields {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-bottom: 0.85rem;
  }

  .login-field label {
    font-size: 0.8125rem;
    margin-bottom: 0.4rem;
  }

  .login-field input {
    min-height: 48px;
    padding: 0.75rem 0.9rem;
    font-size: 16px;
    border-radius: 10px;
    border-color: #e2e8f0;
    background: #f8fafc;
  }

  .login-field input:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(6, 196, 180, 0.12);
  }

  .login-options {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
    font-size: 0.8125rem;
  }

  .login-options label {
    min-height: auto;
    flex-shrink: 0;
  }

  .login-options a {
    min-height: auto;
    text-align: right;
    flex-shrink: 1;
    line-height: 1.35;
  }

  .login-submit {
    min-height: 52px;
    border-radius: 12px;
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 20px rgba(6, 196, 180, 0.28);
  }

  .login-submit:active {
    transform: scale(0.985);
    box-shadow: 0 4px 12px rgba(6, 196, 180, 0.22);
  }

  .login-footer-text {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1.15rem;
    font-size: 0.875rem;
  }

  .login-terms {
    font-size: 0.6875rem;
    margin-top: 0.85rem;
    line-height: 1.5;
  }
}

/* --- Mobile compact --- */
@media (max-width: 575.98px) {
  .login-page {
    background: linear-gradient(180deg, #0c1220 0%, #0c1220 72px, #f1f5f9 72px, #f8fafc 100%);
  }

  .login-visual {
    padding: 0.75rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .login-visual__tagline--short {
    font-size: 0.75rem;
    max-width: 16rem;
  }

  .login-main {
    padding: 1rem 0.85rem 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .login-topnav {
    margin-bottom: 1rem;
  }

  .login-topnav a {
    min-height: 40px;
    font-size: 0.75rem;
    padding: 0.4rem 0.35rem;
  }

  .login-heading {
    margin-bottom: 0.85rem;
    font-size: 1.2rem;
  }

  .login-card {
    border-radius: 14px;
    padding: 1.5rem 1rem 1.2rem;
    padding-top: 1.6rem;
    box-shadow: 0 6px 28px rgba(15, 23, 42, 0.07);
  }

  .login-card__icon {
    width: 36px;
    height: 36px;
    top: -14px;
    font-size: 0.8125rem;
  }

  .login-fields {
    gap: 0.85rem;
  }

  .login-options {
    font-size: 0.78125rem;
  }

  .login-submit {
    min-height: 50px;
  }

  .login-footer-text {
    font-size: 0.8125rem;
    padding: 0 0.15rem;
  }

  .login-terms {
    font-size: 0.625rem;
  }
}

/* --- Très petits écrans --- */
@media (max-width: 360px) {
  .login-topnav a {
    font-size: 0.6875rem;
    letter-spacing: 0;
  }

  .login-heading {
    font-size: 1.1rem;
  }

  .login-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .login-options a {
    align-self: flex-start;
    text-align: left;
  }
}

/* --- Paysage mobile --- */
@media (max-width: 991.98px) and (max-height: 500px) and (orientation: landscape) {
  .login-page {
    flex-direction: row;
    background: #fff;
  }

  .login-visual {
    flex: 0 0 34%;
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  .login-visual__tagline--short {
    display: none;
  }

  .login-main {
    flex: 1;
    padding: 0.75rem 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: none;
  }

  .login-topnav {
    max-width: 100%;
    margin-bottom: 0.65rem;
  }

  .login-heading {
    max-width: 100%;
    margin-bottom: 0.65rem;
    font-size: 1.05rem;
    text-align: left;
  }

  .login-card {
    max-width: 100%;
    padding: 1.15rem 1rem 1rem;
    border-radius: 12px;
  }

  .login-card__icon {
    left: 1rem;
    transform: none;
  }

  .login-fields {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .login-options {
    flex-direction: row;
    align-items: center;
  }

  .login-footer-text {
    max-width: 100%;
    margin-top: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-main {
    animation: none;
  }

  .login-field input,
  .login-submit,
  .login-topnav a {
    transition-duration: 0.01ms;
  }
}
