/* ============================================================
 * iReplace Cloud · login.css
 * Stili specifici della pagina di accesso (resources/views/auth/login.php).
 * Carica DOPO app.css (che fornisce variabili --c-* e tokens).
 *
 * NB: la pagina di login NON ha effetti di apertura animati
 * (l'utente li ha disabilitati: il page reveal a clip-path circle
 * dava un effetto "strano" al caricamento del login). Le transition
 * di hover sono mantenute (focus campo, bottoni, ecc.).
 * ============================================================ */

/* Override: niente animazione di apertura pagina (page reveal in/out) */
body, body.leaving { animation: none !important; }

/* Sfondo "cielo" specifico del login (override del default app.css) */
html, body { overflow-x: hidden; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 700px at 8% 0%, rgba(0,176,239,.32), transparent 60%),
    radial-gradient(900px 700px at 100% 100%, rgba(0,113,155,.28), transparent 55%),
    linear-gradient(160deg, #DCF1FB 0%, #B7E2F6 55%, #84CFEE 100%);
  background-attachment: fixed;
  display: flex; flex-direction: column;
}

/* ---- nuvole SVG statiche (no drift, niente animation) ---- */
.cloud {
  position: fixed; pointer-events: none; z-index: 0;
  opacity: .85;
}
.cloud svg { display: block; }
.cloud.c1 { top: 8%;   left: 6%;   width: 280px; opacity: .70; }
.cloud.c2 { top: 18%;  right: 8%;  width: 220px; opacity: .55; }
.cloud.c3 { bottom: 14%; left: 14%; width: 340px; opacity: .45; }
.cloud.c4 { bottom: 6%;  right: 12%; width: 260px; opacity: .60; }

/* Override locale della topbar (no border-bottom, padding diverso) */
.topbar {
  position: relative; z-index: 2;
  padding: 24px 32px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
}
.topbar .brand-mark { width: 34px; height: 34px; }
.topbar .brand-mark img { width: 24px; height: 24px; }
.topbar .brand-name      { color: var(--c-900); }
.topbar .brand-name b    { font-weight: 700; }
.topbar .brand-name span { color: var(--c-700); font-size: 13px; font-weight: 500; }

/* ---- centered card ---- */
.stage { flex: 1; display: grid; place-items: center; padding: 24px 24px 60px; position: relative; z-index: 2; }
.card {
  width: 100%; max-width: 440px;
  background: rgba(255,255,255,.65);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  box-shadow:
    0 4px 12px rgba(2,40,60,.08),
    0 50px 100px -20px rgba(0,82,115,.40),
    0 30px 60px -20px rgba(0,176,239,.35),
    inset 0 1px 0 rgba(255,255,255,.9);
  padding: 36px 36px 28px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: -40% -40% 40% 40%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.7), transparent 60%);
  pointer-events: none;
}

.logo-big {
  width: 88px; height: 88px; border-radius: 22%;
  background: linear-gradient(160deg, #FFFFFF 0%, #E1F5FD 100%);
  display: grid; place-items: center; overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -14px 24px rgba(0,113,227,.08),
    0 12px 28px rgba(0,113,155,.30);
  margin: 0 auto 18px;
  position: relative; z-index: 1;
}
.logo-big img   { width: 64px; height: 64px; object-fit: contain; }

.card h1 {
  margin: 0 0 4px; text-align: center;
  font-size: 28px; font-weight: 700; letter-spacing: -0.025em;
  color: var(--c-900);
  position: relative; z-index: 1;
}
.card .lede {
  margin: 0 0 22px; text-align: center;
  font-size: 14px; color: var(--c-700);
  position: relative; z-index: 1;
}
.tagline {
  margin: -2px 0 22px; text-align: center;
  font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--c-800);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; position: relative; z-index: 1;
}
.tagline::before, .tagline::after {
  content: ""; flex: 1; max-width: 36px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,113,155,.30), transparent);
}

/* Banner errore login (sopra il form se presente) */
.login-error {
  margin: 14px 0 18px;
  padding: 10px 14px;
  background: rgba(255, 69, 58, .10);
  border: 1px solid rgba(255, 69, 58, .35);
  border-radius: 12px;
  color: #B71D14;
  font-size: 14px;
  font-weight: 500;
}

/* ---- form ---- */
.form  { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.field {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.field:focus-within {
  border-color: var(--c-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,176,239,.20);
}
.field svg.lead    { color: var(--c-600); flex: 0 0 18px; }
.field input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--ink);
  letter-spacing: -0.01em;
}
.field input::placeholder { color: var(--ink-4); }
.field .toggle {
  background: transparent; border: 0; color: var(--ink-4); cursor: pointer;
  padding: 2px; border-radius: 6px;
}
.field .toggle:hover { color: var(--c-700); }

.row-line {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; margin-top: -4px; position: relative; z-index: 1;
}
.row-line label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2);
  user-select: none;
}
.row-line input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--c-600);
  cursor: pointer; display: grid; place-items: center;
  transition: background .15s var(--ease);
}
.row-line input[type=checkbox]:checked { background: var(--c-600); border-color: var(--c-600); }
.row-line input[type=checkbox]:checked::after {
  content: "✓"; color: #fff; font-size: 11px; font-weight: 700;
}
.row-line a       { color: var(--c-700); font-weight: 500; text-decoration: none; }
.row-line a:hover { color: var(--c-900); }

/* ---- buttons ---- */
.btn-primary {
  margin-top: 8px; width: 100%;
  padding: 14px 18px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--c-500) 0%, var(--c-700) 100%);
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  border-radius: 14px;
  box-shadow:
    0 4px 12px rgba(0,113,155,.30),
    0 16px 40px -10px rgba(0,176,239,.40),
    inset 0 1px 0 rgba(255,255,255,.30);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  position: relative; z-index: 1;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(0,113,155,.40),
    0 24px 50px -10px rgba(0,176,239,.55),
    inset 0 1px 0 rgba(255,255,255,.30);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary svg { width: 16px; height: 16px; flex: 0 0 auto; }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 12px; color: var(--ink-4); font-size: 12px;
  position: relative; z-index: 1;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(0,113,155,.25), transparent);
}

.btn-ghost {
  width: 100%; padding: 12px 18px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line); cursor: pointer;
  color: var(--c-900); font-size: 14px; font-weight: 500;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
  position: relative; z-index: 1;
}
.btn-ghost { text-decoration: none; }
.btn-ghost:hover { background: #fff; border-color: var(--c-400); transform: translateY(-1px); }
.estendo-mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, #1FA055, #0E6E3A);
  display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800;
}
.ms-logo { width: 18px; height: 18px; display: grid; place-items: center; }
.ms-logo svg { display: block; }
.sso-actions { margin-top: 18px; }
.sso-actions .btn-primary { text-decoration: none; }

/* ---- Password dimenticata / reset ---- */
.lbl {
  font-size: 12px; font-weight: 700; color: var(--c-800);
  text-transform: uppercase; letter-spacing: .05em;
  position: relative; z-index: 1;
}
.back-link {
  margin-top: 18px; text-align: center; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: var(--c-700); font-weight: 600; text-decoration: none;
}
.back-link svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.back-link:hover { color: var(--c-900); }
.back-link:hover svg { transform: translateX(-3px); }

.sent { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; z-index: 1; }
.sent .badge {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; margin: 0 auto 20px;
  background: linear-gradient(160deg, #5BE49B, #1FA055);
  box-shadow: 0 14px 30px -8px rgba(31,160,85,.6); position: relative;
}
.sent .badge::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 1.5px solid rgba(31,160,85,.3); animation: halo 2.4s var(--ease) infinite;
}
@keyframes halo { 0%{transform:scale(.85);opacity:.8} 100%{transform:scale(1.12);opacity:0} }
.sent .badge svg { width: 40px; height: 40px; }
.sent h1 { margin: 0 0 8px; font-size: 25px; font-weight: 700; letter-spacing: -0.025em; color: var(--c-900); }
.sent p { margin: 0 0 4px; font-size: 14.5px; line-height: 1.6; color: var(--c-700); max-width: 340px; }
.sent p b { color: var(--c-900); font-weight: 600; }
.sent .hint { margin-top: 16px; font-size: 12.5px; color: var(--ink-4, #8AA0B2); }
.sent .resend { margin-top: 22px; font-size: 13.5px; color: var(--c-700); }
.sent .resend button {
  background: none; border: 0; color: var(--c-700); font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.sent .resend button:disabled { color: var(--ink-4, #8AA0B2); cursor: not-allowed; text-decoration: none; }

/* ---- footer help + legal ---- */
.footer-help {
  margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--c-700);
  position: relative; z-index: 1;
}
.footer-help a { color: var(--c-800); font-weight: 500; }

.legal {
  margin-top: 24px; text-align: center;
  font-size: 11.5px; color: var(--c-800);
  opacity: .65;
  position: relative; z-index: 2;
}
.legal b { font-weight: 600; }

@media (max-width: 520px) {
  .card     { padding: 28px 22px 22px; border-radius: 24px; }
  .logo-big { width: 72px; height: 72px; }
  .logo-big img { width: 52px; height: 52px; }
  .card h1  { font-size: 24px; }
}

/* ── FIX scroll login su viewport bassi (verifica 2026) ──────────────────────
   Diagnosi: nessun contenitore era uno scroll-container legato al viewport; la
   .stage aveva un'altezza in px (da flex:1) con overflow-y:auto e "sforava"
   invece di scrollare, e .card overflow:hidden tagliava il fondo.
   Correzione: lo scroll avviene sul DOCUMENTO (html/body legati al viewport);
   la .stage NON è più uno scroll-container (niente height/overflow fissi);
   la card si centra con margin:auto e, se più alta del viewport, si allinea in
   alto e la pagina scrolla fino a "Accedi". */
/* Lo scroll è quello NATURALE del documento: il contenitore è <html>.
   NIENTE overflow-y:auto sul body — un body "auto" ma non scrollabile mangia gli
   eventi della rotellina (scrollava solo trascinando la scrollbar). */
html {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;            /* html = unico scroll-container (documento) */
}
body {
  min-height: 100vh;
  height: auto !important;     /* mai altezza fissa: cresce col contenuto */
  max-height: none !important;
  overflow: visible !important; /* body NON è uno scroll-container → rotellina → html */
}
.stage {
  flex: 1 0 auto;               /* cresce col contenuto (spinge il body → scroll) */
  display: flex !important;
  align-items: flex-start;      /* la card non viene stirata/tagliata */
  justify-content: center;
  min-height: 0;
  height: auto !important;      /* annulla eventuale height in px */
  overflow: visible !important; /* NON è uno scroll-container */
  padding-block: 24px 48px;
}
.card {
  margin: auto !important;      /* centrata se entra, in alto+scroll se più alta */
  overflow: visible !important; /* il fondo della card non viene tagliato */
}
@media (max-height: 700px) {
  .stage { padding-top: 12px; padding-bottom: 24px; }
}
