/* ============================================
   ISF - PAGE DE CONNEXION
   ============================================ */

body {
  margin: 0;
  position: relative;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: -30%;
  pointer-events: none;
  z-index: 0;
  background: conic-gradient(from 220deg at 52% 42%, transparent 0deg, rgba(255, 225, 225, 0.22) 18deg, transparent 36deg, transparent 360deg);
  filter: blur(10px);
  mix-blend-mode: screen;
  opacity: 0.5;
  animation: brilliance-sweep 14s ease-in-out infinite;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #520b0b;
  background-image:
    radial-gradient(ellipse 78% 58% at 18% 28%, rgba(185, 28, 28, 0.85) 0%, transparent 65%),
    radial-gradient(ellipse 62% 78% at 82% 72%, rgba(127, 29, 29, 0.78) 0%, transparent 60%),
    radial-gradient(circle at 52% 8%, rgba(255, 244, 244, 0.16) 0%, transparent 28%),
    linear-gradient(140deg, #7f1d1d 0%, #5c0f0f 45%, #3f0909 100%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(32deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 10px),
    radial-gradient(circle at 50% 50%, transparent 0 48%, rgba(0, 0, 0, 0.2) 100%);
  background-blend-mode: screen, screen, screen, normal, overlay, soft-light, multiply;
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 260px 260px, 180px 180px, 100% 100%;
  padding: var(--sp-lg);
  position: relative;
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
  animation: bg-drift 16s ease-in-out infinite alternate;
}

@keyframes brilliance-sweep {
  0%,
  100% {
    transform: translateX(-8%) translateY(0) rotate(0deg) scale(1);
    opacity: 0.38;
  }
  50% {
    transform: translateX(10%) translateY(-4%) rotate(7deg) scale(1.08);
    opacity: 0.62;
  }
}

.login-container::before,
.login-container::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: orb-float 8s ease-in-out infinite;
}

.login-container::before {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.35) 0%, rgba(185, 28, 28, 0.15) 50%, transparent 70%);
  top: -160px;
  left: -160px;
  filter: blur(2px);
  box-shadow: 0 0 70px rgba(239, 68, 68, 0.18);
  animation-duration: 9s;
}

.login-container::after {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(252, 165, 165, 0.2) 0%, rgba(239, 68, 68, 0.1) 50%, transparent 70%);
  bottom: -140px;
  right: -100px;
  filter: blur(2px);
  box-shadow: 0 0 60px rgba(252, 165, 165, 0.12);
  animation-duration: 11s;
  animation-delay: -4s;
}

@keyframes bg-drift {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 0 0, 0 0, 0 0, 0 0, 130px 90px, -90px 120px, 0 0;
  }
}

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -25px) scale(1.06); }
  66%       { transform: translate(-20px, 20px) scale(0.95); }
}

.login-card {
  background-color: var(--bg-light);
  border-radius: 16px;
  padding: var(--sp-xl);
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 10px 38px rgba(127, 29, 29, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
  z-index: 1;
  backdrop-filter: blur(2px);
  animation: slideUp 500ms ease, card-breathe 6s ease-in-out infinite;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -60% -35%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.46) 50%, transparent 65%);
  transform: translateX(-62%) rotate(8deg);
  pointer-events: none;
  opacity: 0.38;
  animation: premium-shine 7s ease-in-out infinite;
}

.login-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

@keyframes premium-shine {
  0%, 18% { transform: translateX(-62%) rotate(8deg); opacity: 0; }
  28% { transform: translateX(-30%) rotate(8deg); opacity: 0.42; }
  40% { transform: translateX(8%) rotate(8deg); opacity: 0.18; }
  100% { transform: translateX(62%) rotate(8deg); opacity: 0; }
}

@keyframes card-breathe {
  0%, 100% {
    box-shadow:
      0 24px 64px rgba(0, 0, 0, 0.45),
      0 10px 38px rgba(127, 29, 29, 0.22),
      0 0 0 1px rgba(255, 255, 255, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
  50% {
    box-shadow:
      0 28px 72px rgba(0, 0, 0, 0.48),
      0 14px 46px rgba(185, 28, 28, 0.32),
      0 0 0 1px rgba(255, 255, 255, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.16);
  }
}

.login-logo {
  --login-brand-width: 250px;
  display: flex;
  justify-content: center;
  width: var(--login-brand-width);
  max-width: 100%;
  margin: 0 auto var(--sp-sm);
}

.login-logo-image {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.login-logo svg {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.3));
}

.login-title {
  margin: 0 0 var(--sp-sm) 0;
  text-align: center;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  width: 250px;
  max-width: 100%;
  text-align: center;
  color: var(--text-secondary);
  margin: 0 auto var(--sp-lg);
  font-size: 0.95rem;
}

.login-help-row {
  text-align: center;
  margin: 0 0 var(--sp-md);
}

.forgot-password-link {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.forgot-password-panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: var(--sp-md);
  margin: 0 0 var(--sp-md);
}

.forgot-password-text {
  margin: 0 0 var(--sp-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.forgot-password-panel .btn {
  width: 100%;
  justify-content: center;
}

.login-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #7f1d1d;
  padding: var(--sp-md);
  border-radius: 8px;
  margin-bottom: var(--sp-lg);
  animation: slideDown 250ms ease;
}

.login-form {
  margin-bottom: var(--sp-xl);
}

.login-remember {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}

.login-remember input[type="checkbox"] {
  width: auto;
  cursor: pointer;
  margin: 0;
}

.login-remember label {
  margin: 0;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-button {
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 300ms ease;
  position: relative;
  overflow: hidden;
}

.login-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 300ms ease;
}

.login-button:hover::before {
  left: 100%;
}

.login-button:hover {
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.login-button:active {
  transform: translateY(0);
}

.login-footer {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--border-light);
}

.login-footer p {
  margin: 0;
}

/* Password toggle button */
.password-input-wrapper {
  position: relative;
}

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

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--trans-fast);
}

.password-toggle:hover {
  color: var(--accent);
}

/* Dark mode */
html.dark-mode .login-card {
  background-color: var(--bg-dark);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

html.dark-mode .login-error {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

html.dark-mode .login-footer {
  border-top-color: var(--border-dark);
}

html.dark-mode .forgot-password-panel {
  background: rgba(17, 24, 39, 0.8);
  border-color: var(--border-dark);
}

/* Responsive */
@media (max-width: 520px) {
  .login-container {
    padding: var(--sp-md);
  }

  .login-card {
    padding: var(--sp-lg);
    margin: 0;
    max-width: 100%;
  }

  .login-title {
    font-size: 1.5rem;
  }

  .login-logo svg {
    width: 80px;
    height: 80px;
  }

  .login-logo-image {
    width: 200px;
  }

  .login-subtitle {
    width: 200px;
    margin-bottom: var(--sp-md);
  }

  .login-help-row {
    margin-bottom: var(--sp-sm);
  }

  .login-button {
    padding: 10px 20px;
    font-size: 1rem;
  }
}
