/* ============================================================================
   auth-shell.css — pattern visivo condiviso delle pagine di autenticazione
   (login, registrati, accetta_invito, scegli_tenant).

   Contiene SOLO le regole comuni a tutte le pagine. Le specificità (es.
   .pwd-rules-box di registrati, .tenant-card di scegli_tenant, .invitato-da
   di accetta_invito) restano in ogni pagina.

   Sfondo personalizzabile per tenant: la pagina può applicare la classe
   `.has-custom-bg` su `.bg-shell` e definire la CSS variable `--auth-bg`
   (URL immagine o gradiente) per sostituire il default.
   ============================================================================ */

:root {
    --bg-0:   #0b111a;
    --bg-1:   #111a26;
    --bg-2:   #18243a;
    --bg-3:   #1f3358;
    --ink:    #1d1d1f;
    --ink-2:  #3a3a3c;
    --muted:  #6e6e73;
    --muted-2:#8e8e93;
    --line:   #e5e5ea;
    --line-2: #d8d8dc;
    --field:  #f4f4f6;
    --accent: #1d6ed8;
    --accent-2:#1657ad;
    --danger: #b3261e;
    --danger-bg:#fdecea;
    --ok:     #16704a;
    --ok-bg:  #e6f4ec;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 13px;
    color: var(--ink);
    background: var(--bg-0);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sfondo: gradiente notturno freddo + reticolo topografico sottile */
.bg-shell {
    position: fixed; inset: 0;
    background:
      radial-gradient(1200px 700px at 75% 15%, rgba(56,116,200,0.18), transparent 60%),
      radial-gradient(900px 700px at 10% 90%, rgba(30,58,138,0.22), transparent 55%),
      linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 35%, var(--bg-2) 75%, var(--bg-3) 100%);
    z-index: 0;
    overflow: hidden;
}
.bg-shell::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 56px 56px, 56px 56px;
    mask-image: radial-gradient(circle at 50% 45%, black 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 50% 45%, black 0%, transparent 70%);
    pointer-events: none;
}

/* Sfondo personalizzato dal tenant: --auth-bg può essere
   url('...'), un gradiente, o qualunque altra background-image valida.
   Sopprime il reticolo topografico per non disturbare l'immagine. */
.bg-shell.has-custom-bg {
    background:
      var(--auth-bg, none) center/cover no-repeat fixed,
      linear-gradient(160deg, var(--bg-0), var(--bg-2));
}
.bg-shell.has-custom-bg::before { display: none; }

/* Card frosted glass — stesso effetto del .pill-menu del prototipo */
.auth-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    padding: 32px 32px 24px;
    box-shadow:
      0 24px 48px -12px rgba(0,0,0,0.55),
      0 2px 6px rgba(0,0,0,0.25);
    animation: card-in 0.18s ease-out;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Brand mark + nome */
.brand {
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}
.brand-mark {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    display: flex; align-items: center; justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(29,110,216,0.35);
}
.brand-mark svg { width: 18px; height: 18px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--ink);
}

/* Avvisi */
.alert {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.alert.error  { background: var(--danger-bg); color: var(--danger); border-color: rgba(179,38,30,0.18); }
.alert.error svg  { stroke: var(--danger); }
.alert.success{ background: var(--ok-bg); color: var(--ok); border-color: rgba(22,112,74,0.18); }
.alert.success svg{ stroke: var(--ok); }

/* Form fields */
.field { margin-bottom: 12px; }
.field-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted-2);
    font-weight: 600;
    margin-bottom: 5px;
}
.input-wrap {
    position: relative;
    display: flex; align-items: center;
}
.input-wrap svg.field-icon {
    position: absolute; left: 10px;
    width: 14px; height: 14px;
    stroke: var(--muted-2); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    pointer-events: none;
}
.input-wrap input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: #ffffff;
    font-size: 13px;
    color: var(--ink);
    font-family: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
    outline: none;
}
.input-wrap input::placeholder { color: var(--muted-2); }
.input-wrap input:hover { border-color: #c7c7cc; }
.input-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(29,110,216,0.15);
}
.input-wrap:focus-within svg.field-icon { stroke: var(--accent); }

/* Submit button */
button.btn-submit {
    width: 100%;
    padding: 9px 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.12s ease, opacity 0.12s ease;
}
button.btn-submit:hover:not(:disabled) { background: var(--accent-2); }
button.btn-submit:active:not(:disabled) { background: #12498f; }
button.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
button.btn-submit.loading {
    color: transparent;
    position: relative;
    pointer-events: none;
}
button.btn-submit.loading::after {
    content: ""; position: absolute;
    top: 50%; left: 50%;
    width: 14px; height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer card */
.auth-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}
.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
}
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .auth-card { padding: 26px 22px 20px; border-radius: 10px; }
}
