/* =====================================================================
   login.css - pagina di accesso (login.php)
   Pannello di presentazione a sinistra, card del form a destra.
   ===================================================================== */

@keyframes es-pop      { from { opacity: 0; transform: scale(.6) translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes es-bob      { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes es-in-right { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes es-spin     { to { transform: rotate(360deg); } }
@keyframes es-draw     { to { stroke-dashoffset: 0; } }
@keyframes es-shake-a  { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes es-shake-b  { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes es-out      { to { opacity: 0; transform: scale(.97); } }
@keyframes es-sheen    { from { transform: translateX(-120%); } to { transform: translateX(220%); } }

.es-up { animation: es-up .6s cubic-bezier(.2, .8, .2, 1) both; }

.login {
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap;
    background: var(--es-bg);
    color: var(--es-ink);
}

.login.is-leaving { animation: es-out .45s ease forwards; }

/* ---- Pannello di presentazione ------------------------------------- */
.login-hero {
    flex: 1 1 480px;
    position: relative;
    overflow: hidden;
    background: var(--es-navy);
    color: #ffffff;
    padding: 40px 48px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    min-height: 340px;
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-name { font-weight: 800; font-size: 20px; line-height: 22px; letter-spacing: -.01em; }
.login-brand-sub  { font-weight: 500; font-size: 12px; opacity: .75; }

.login-tiles {
    position: absolute;
    /* Griglia larga 352px (4 x 76 + 3 x 16). Centrata nello spazio libero a destra del testo
       (che termina a 468px = padding 48 + testo 380 + respiro 40); se il pannello e' troppo
       stretto per contenerla, resta la posizione del template (sporge di 40px a destra). */
    left: min(calc((100% + 468px) / 2 - 176px), calc(100% - 312px));
    top: 90px;
    display: grid;
    grid-template-columns: repeat(4, 76px);
    gap: 16px;
}

.login-tile {
    height: 76px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .07);
    animation: es-pop .7s cubic-bezier(.2, .9, .3, 1.2) both, es-bob 6s ease-in-out infinite;
}

.login-tile.t-slate  { background: #3f6283; }
.login-tile.t-orange { background: #c76a00; }
.login-tile.t-red    { background: #c0432a; }
.login-tile.t-amber  { background: var(--es-amber); }
.login-tile.t-teal   { background: #0d7f81; }
.login-tile.t-green  { background: #26834a; }
.login-tile.t-purple { background: #7d3a8c; }
.login-tile.t-blue   { background: var(--es-blue); }
.login-tile.t-gray   { background: #5f6775; }

/* Entrata a cascata + oscillazione sfasata, come nel template */
.login-tile:nth-child(1)  { animation-delay: .05s, 0s; }
.login-tile:nth-child(2)  { animation-delay: .12s, -1s; }
.login-tile:nth-child(3)  { animation-delay: .19s, -2.4s; }
.login-tile:nth-child(4)  { animation-delay: .26s, -3s; }
.login-tile:nth-child(5)  { animation-delay: .33s, -.6s; }
.login-tile:nth-child(6)  { animation-delay: .40s, -4.2s; }
.login-tile:nth-child(7)  { animation-delay: .47s, -1.8s; }
.login-tile:nth-child(8)  { animation-delay: .54s, -5s; }
.login-tile:nth-child(9)  { animation-delay: .61s, -2s; }
.login-tile:nth-child(10) { animation-delay: .68s, -3.6s; }
.login-tile:nth-child(11) { animation-delay: .75s, -.3s; }
.login-tile:nth-child(12) { animation-delay: .82s, -4.8s; }
.login-tile:nth-child(13) { animation-delay: .89s, -1.2s; }
.login-tile:nth-child(14) { animation-delay: .96s, -2.7s; }
.login-tile:nth-child(15) { animation-delay: 1.03s, -3.9s; }
.login-tile:nth-child(16) { animation-delay: 1.10s, -.9s; }

.login-claim { position: relative; z-index: 1; max-width: 380px; }

.login-title {
    margin: 0;
    font-size: 44px;
    line-height: 48px;
    font-weight: 800;
    letter-spacing: -.02em;
    animation-delay: .2s;
}

.login-lead {
    margin: 16px 0 0;
    font-size: 16px;
    line-height: 24px;
    color: #c9d4e6;
    animation-delay: .32s;
}

.login-chips {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    animation-delay: .44s;
}

.login-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    font-size: 12px;
    font-weight: 600;
}

.login-host {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: #9fb0cc;
    animation-delay: .5s;
}

/* ---- Card del form ------------------------------------------------- */
.login-side {
    flex: 1 1 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    box-sizing: border-box;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--es-line);
    border-radius: 22px;
    padding: 40px 36px;
    box-sizing: border-box;
    box-shadow: 0 30px 60px -30px rgba(15, 27, 51, .28);
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: es-in-right .7s cubic-bezier(.2, .8, .2, 1) .15s both;
}

.login-fields { display: flex; flex-direction: column; gap: 18px; }
.login-fields.es-shake-a { animation: es-shake-a .5s both; }
.login-fields.es-shake-b { animation: es-shake-b .5s both; }

.login-card h2 {
    margin: 0;
    font-size: 28px;
    line-height: 34px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.login-intro {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 21px;
    color: var(--es-muted);
}

.es-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.es-label-row { display: flex; justify-content: space-between; }
.es-label-row label { margin: 0; }

.es-link { font-weight: 600; text-decoration: none; }

.es-field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid var(--es-line);
    border-radius: 12px;
    background: var(--es-bg);
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.es-field--pw { padding: 0 6px 0 14px; }

.es-field:focus-within {
    border-color: var(--es-blue);
    box-shadow: 0 0 0 4px rgba(31, 95, 168, .16);
    background: #ffffff;
}

.es-field.is-invalid { border-color: var(--es-danger); }

.es-field input {
    all: unset;
    flex: 1;
    min-width: 0;
    font: 500 15px/22px var(--es-font);
    color: var(--es-ink);
}

.es-field input::placeholder { color: #7a8496; }

.es-eye {
    all: unset;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--es-muted);
}

.es-eye:focus-visible,
.es-link:focus-visible { outline: 2px solid var(--es-blue); outline-offset: 3px; }

.login-error {
    font-size: 12px;
    font-weight: 600;
    color: var(--es-danger);
}

/* licenza scaduta: pulsante «Invia link per il pagamento» ed esito dell'invio */
.login-paga-link { align-self: flex-start; margin-top: 4px; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--es-amber);
    color: var(--es-ink); font: 700 13.5px var(--es-font); cursor: pointer; transition: filter .15s; }
.login-paga-link:hover { filter: brightness(.95); }
.login-paga-link:focus-visible { outline: 2px solid var(--es-navy); outline-offset: 2px; }
.login-paga-link:disabled { opacity: .65; cursor: wait; }
.login-paga-link[hidden], .login-paga-esito[hidden] { display: none; }
.login-paga-esito { font-size: 12.5px; font-weight: 600; line-height: 1.45; color: var(--es-success); }
.login-paga-esito.is-ko { color: var(--es-danger); }

.login-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    color: var(--es-muted);
    cursor: pointer;
}

.login-remember input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--es-blue);
}

/* ---- Pulsante Accedi con stati idle / loading / ok ----------------- */
.login-submit {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 12px;
    background: var(--es-blue);
    color: #ffffff;
    font-family: var(--es-font);
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s;
}

.login-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -10px rgba(31, 95, 168, .7); }
.login-submit:active { transform: translateY(0); }
.login-submit:focus-visible { outline: 2px solid var(--es-blue); outline-offset: 3px; }
.login-submit:disabled { cursor: default; }

.login-submit::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
    transform: translateX(-120%);
}

.login-submit:hover::after { animation: es-sheen .9s ease; }

.login-submit[data-stato="ok"] { background: var(--es-success); }

.login-submit .stato { display: none; align-items: center; gap: 10px; }
.login-submit[data-stato="idle"]    .stato-idle,
.login-submit[data-stato="loading"] .stato-loading,
.login-submit[data-stato="ok"]      .stato-ok { display: flex; }

.es-spin  { animation: es-spin .8s linear infinite; }
.es-check { stroke-dasharray: 30; stroke-dashoffset: 30; animation: es-draw .45s ease .1s forwards; }

.login-foot {
    margin: 4px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 18px;
    color: var(--es-muted);
}

/* ---- Schermi piccoli: le tessere decorative coprirebbero il testo -- */
@media (max-width: 720px) {
    .login-hero { padding: 28px 24px; min-height: 0; gap: 28px; }
    .login-tiles { display: none; }
    .login-title { font-size: 34px; line-height: 38px; }
    .login-card { padding: 32px 22px; }
}

/* ---- Registrazione di una nuova azienda ------------------------------ */
.login-sep { display: flex; align-items: center; gap: 12px; margin: 2px 0 -4px; color: var(--es-muted); font-size: 12.5px; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--es-line); }
.login-registrati {
    all: unset; box-sizing: border-box; cursor: pointer; height: 48px; border-radius: 12px; border: 1.5px solid var(--es-line);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font: 800 14px/1 var(--es-font); letter-spacing: .04em; color: var(--es-navy); background: #ffffff;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.login-registrati:hover { border-color: var(--es-blue); background: #f4f8fd; }
.login-registrati:focus-visible { outline: none; border-color: var(--es-blue); box-shadow: 0 0 0 4px rgba(31, 95, 168, .16); }
.reg .modal-title { font-size: 22px; font-weight: 800; }
.reg-intro { margin: 4px 0 0; font-size: 13.5px; color: var(--es-muted); }
.reg-gruppo { margin: 0 0 18px; padding: 16px 18px 18px; border: 1px solid var(--es-line); border-radius: 16px; }
.reg-gruppo legend { float: none; width: auto; margin: 0; padding: 0 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--es-blue); }
.reg .form-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.reg-obbl { color: var(--es-danger); }
.reg-trappola { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.reg-privacy { font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.reg-privacy .form-check-input { flex: none; margin: 2px 0 0; }
.reg-privacy.is-invalid { color: var(--es-danger); }
.reg-errore { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: #ffe3e0; color: #b3261e; font-size: 13.5px; font-weight: 600; }

/* registrazione: scelte dell'abbonamento */
.reg-prova { margin: 0 0 12px; }
.reg-prezzo { padding: 10px 14px; border-radius: 12px; background: #eef5fd; border: 1px solid #c9dcf2; color: #184c86; font-size: 14px; }
.reg-prezzo[hidden] { display: none; }
/* periodo beta: al posto di piani e prezzi */
.reg-beta { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid #ecd9a6; border-radius: 16px; background: #fdf6e3; color: #4a3a12; }
.reg-beta p { margin: 0; font-size: 14px; line-height: 1.5; }
.reg-beta-bollo { flex: none; padding: 5px 12px; border-radius: 999px; background: #f2a71b; color: #3a2a00; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 575.98px) { .reg-beta { flex-direction: column; gap: 8px; } }
/* tessere dei piani: Basic sobria, Professional in oro */
.reg-piani { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.reg-piani.is-invalid .reg-piano { border-color: #bb3329; }
.reg-piano { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 2px solid #d3dae6; border-radius: 18px;
             background: linear-gradient(160deg, #ffffff, #f3f6fb); color: #0f1b33; transition: transform .15s, border-color .2s, box-shadow .2s; }
.reg-piano:hover { transform: translateY(-2px); border-color: #8792a6; }
.reg-piano:focus-visible { outline: 3px solid rgba(31, 95, 168, .35); outline-offset: 2px; }
.reg-piano-testa { display: flex; align-items: center; gap: 8px; }
.reg-piano-nome { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.reg-piano-badge { padding: 2px 9px; border-radius: 999px; background: rgba(90, 58, 0, .14); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.reg-piano-spunta { margin-left: auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c5cfdd; color: transparent; background: #ffffff; flex: none; }
.reg-piano-prezzo { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.reg-piano-prezzo b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.reg-piano-prezzo small { font-size: 12.5px; font-weight: 600; opacity: .75; }
.reg-piano-voci { display: flex; flex-wrap: wrap; gap: 6px; }
.reg-piano-voci span { padding: 3px 10px; border-radius: 999px; background: rgba(15, 27, 51, .07); font-size: 12.5px; font-weight: 700; }
.reg-piano.is-on { border-color: #1f5fa8; box-shadow: 0 0 0 4px rgba(31, 95, 168, .16), 0 16px 26px -18px rgba(15, 27, 51, .6); }
.reg-piano.is-on .reg-piano-spunta { border-color: #1f5fa8; background: #1f5fa8; color: #ffffff; }
/* Professional: oro */
.reg-piano--oro { border-color: #d9a520; color: #4a3200; background: linear-gradient(150deg, #fff6d6 0%, #f7d774 45%, #e9b93a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 14px 24px -18px rgba(150, 100, 0, .8); }
.reg-piano--oro:hover { border-color: #b8860b; }
.reg-piano--oro .reg-piano-voci span { background: rgba(255, 255, 255, .55); }
.reg-piano--oro .reg-piano-voci span.is-piu { background: #4a3200; color: #ffe9a8; }
.reg-piano--oro .reg-piano-spunta { border-color: #b8860b; background: rgba(255, 255, 255, .7); }
.reg-piano--oro.is-on { border-color: #8a6100; box-shadow: 0 0 0 4px rgba(217, 165, 32, .35), 0 16px 26px -16px rgba(120, 80, 0, .9); }
.reg-piano--oro.is-on .reg-piano-spunta { border-color: #4a3200; background: #4a3200; color: #ffe9a8; }
@media (prefers-reduced-motion: reduce) { .reg-piano { transition: none; } .reg-piano:hover { transform: none; } }
