/* RESET DI BASE */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* BODY */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  color: #f5f5f5;
  overflow: hidden;
}

/* CONTAINER PRINCIPALE */
.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SFONDO FORESTA + GRADIENTE */
.login-bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(3, 12, 24, 0.85), rgba(0, 0, 0, 0.7)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=80")
      center center / cover no-repeat;
  z-index: -1;
  transform: translate3d(0,0,0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* CARD DI LOGIN */
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 30px;
  background: rgba(6, 18, 36, 0.88);
  border-radius: 18px;
  border: 1px solid rgba(89, 205, 255, 0.45);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(0, 200, 255, 0.35);
  backdrop-filter: blur(16px);
}

/* Durante transizione: elimina blur (performance + pulizia visiva) */
body.is-transitioning .login-card{
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* HEADER */
.login-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-header h1 {
  font-size: 1.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.login-header p {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* MESSAGGI */
.login-info,
.login-alert {
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.login-info {
  background: rgba(0, 180, 255, 0.12);
  border: 1px solid rgba(0, 188, 255, 0.6);
}

.login-alert {
  background: rgba(255, 86, 110, 0.14);
  border: 1px solid rgba(255, 86, 110, 0.7);
}

/* FORM */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-label span {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.9;
}

.login-label input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(130, 190, 255, 0.4);
  background: rgba(1, 10, 22, 0.9);
  color: #f5f5f5;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

.login-label input::placeholder {
  color: rgba(200, 210, 230, 0.6);
}

.login-label input:focus {
  border-color: rgba(0, 210, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 210, 255, 0.7);
  background: rgba(4, 20, 40, 0.98);
}

/* BUTTON */
.login-btn {
  margin-top: 6px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: radial-gradient(circle at 0 0, #00f5ff, #007bff);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 180, 255, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease,
    filter 0.1s ease;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 200, 255, 0.6);
  filter: brightness(1.03);
}

.login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 8px 18px rgba(0, 160, 230, 0.5);
}

/* MOBILE */
@media (max-width: 600px) {
  .login-card {
    max-width: 90%;
    padding: 24px 20px 22px;
  }

  .login-header h1 {
    font-size: 1.5rem;
  }
}

/* =========================================================
   DISSOLVENZA USCITA (VISIBILE, ZERO SCATTI)
   ========================================================= */

/* Overlay nero */
.login-fade {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity 900ms ease;
}

/* attiva */
.login-fade.on {
  opacity: 1;
}

/* form/card spariscono con fade */
.login-form.is-leaving {
  animation: formFadeOut 240ms ease forwards;
}
@keyframes formFadeOut {
  to { opacity: 0; transform: translateY(6px); }
}

.login-card.is-leaving {
  animation: cardFadeOut 520ms ease forwards;
  animation-delay: 120ms;
  will-change: transform, opacity;
}
@keyframes cardFadeOut {
  to { opacity: 0; transform: translateY(10px) scale(0.99); }
}

/* ACCESSIBILITÀ (FIX: niente schermo nero se reduce-motion è attivo) */
@media (prefers-reduced-motion: reduce) {
  .login-fade { transition: none !important; opacity: 0 !important; }
  .login-fade.on { opacity: 1 !important; }

  .login-form.is-leaving,
  .login-card.is-leaving {
    animation: none !important;
  }
}


