/* ===========================================================================
 * White-label V1 "Modern SaaS" — Auth shell condiviso login + MFA.
 *
 * Layout: split-screen 60/40 desktop, stacked mobile <900px.
 * Immagine hero = BACKGROUND di TUTTA la pagina (entrambi i pane).
 * Form card resta nel pane destro (no spostamento).
 *
 *   ┌─────────────────────────┬────────────┐
 *   │                         │            │
 *   │  [hero image            │  ┌──────┐  │
 *   │   bg dell'intera        │  │ form │  │
 *   │   pagina, occupa anche  │  │ card │  │
 *   │   il pane destro        │  │      │  │
 *   │   sotto la card]        │  └──────┘  │
 *   │                         │            │
 *   └─────────────────────────┴────────────┘
 *
 * Animations rispettano prefers-reduced-motion.
 * ========================================================================= */

:root {
    --auth-primary: var(--brand-primary, #3b82f6);
}

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

/* ===== ROOT SHELL: grid 60/40 con bg image full-pagina ============ */
.auth-shell {
    position: relative;
    display: grid;
    grid-template-columns: 60% 40%;
    min-height: 100vh;
    background: #0b1220; /* fallback navy scuro mentre l'immagine carica */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
}
@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(180px, 30vh) 1fr;
    }
}

/* ===== HERO IMAGE — Background dell'INTERA pagina (entrambi i pane) === */
.auth-hero {
    position: absolute;
    inset: 0;             /* copre TUTTO lo shell, non solo la colonna sinistra */
    z-index: 0;
    overflow: hidden;
    pointer-events: none; /* lascia i click passare alla card */
}
.auth-hero-fullimg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Fallback SVG (no raster uploadato): scaled centrato. */
.auth-hero-illustration--fallback {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 60%);
    height: auto;
    color: #ffffff;
    opacity: 0.4;
}

/* ===== FORM PANE (destra) — trasparente sopra l'hero ================ */
.auth-form-pane {
    position: relative;       /* sopra .auth-hero per z-index stacking */
    z-index: 1;
    grid-column: 2;           /* destra del grid */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: transparent;  /* niente bg, l'hero si vede sotto */
}
@media (max-width: 900px) {
    .auth-form-pane {
        grid-column: 1;
        grid-row: 2;
        padding: 1.5rem 1rem;
        align-items: flex-start;
    }
}

/* ===== FORM CARD (resta nel pane destro) =========================== */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;      /* card opaca per leggibilita' del form */
    border-radius: 16px;
    padding: 2rem;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: auth-card-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
}
@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem 1.2rem; }
}

/* ===== BRAND HEADER nella card (logo + tagline) ===================== */
.auth-form-brand {
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid #f1f5f9;
}
.auth-form-logo {
    max-width: 180px;
    height: auto;
    display: block;
    margin-bottom: 0.6rem;
}
.auth-form-tagline {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
    font-weight: 500;
}

.auth-greeting {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.3rem;
    letter-spacing: -0.01em;
}
.auth-subgreeting {
    color: #64748b;
    font-size: 0.88rem;
    margin: 0 0 1.6rem;
    line-height: 1.5;
}

/* ===== FORM FIELDS ================================================== */
.auth-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.4rem;
    letter-spacing: -0.005em;
}

.auth-field {
    margin-bottom: 1.4rem;
    position: relative;
}
.auth-field smart-text-box,
.auth-field smart-password-text-box {
    display: block;
    width: 100%;
    min-height: 44px;
}
.auth-field smart-text-box .smart-label,
.auth-field smart-password-text-box .smart-label {
    display: none !important;
}
.auth-field smart-text-box:focus-within,
.auth-field smart-password-text-box:focus-within {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-primary) 18%, transparent);
    border-radius: 6px;
    transition: box-shadow 0.15s;
}
.auth-field smart-check-box {
    display: block;
    margin-top: 4px;
}

.auth-toggle-pwd {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.3rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 0.78rem;
    padding: 0.2rem 0;
    border-radius: 4px;
    transition: color 0.15s;
    font-family: inherit;
}
.auth-toggle-pwd:hover { color: var(--auth-primary); }
.auth-toggle-pwd:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}
.auth-toggle-pwd .material-symbols-outlined { font-size: 16px; vertical-align: -2px; }

.auth-capslock {
    display: none;
    font-size: 0.78rem;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    margin-top: 0.4rem;
    align-items: center;
    gap: 0.4rem;
}
.auth-capslock.show { display: flex; }
.auth-capslock .material-symbols-outlined { font-size: 16px; }

/* ===== SUBMIT BUTTON ================================================ */
.auth-submit {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--auth-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 0.6rem;
    transition: filter 0.15s, transform 0.05s, box-shadow 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.auth-submit:hover:not(:disabled) {
    filter: brightness(0.93);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--auth-primary) 30%, transparent);
}
.auth-submit:active:not(:disabled) { transform: scale(0.99); }
.auth-submit:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}
.auth-submit:disabled { opacity: 0.7; cursor: progress; }

.auth-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: auth-spin 0.6s linear infinite;
    flex-shrink: 0;
}
.auth-submit.is-loading .auth-spinner { display: inline-block; }
.auth-submit.is-loading .auth-submit-label { opacity: 0.65; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .auth-spinner { animation: none; border-top-color: currentColor; opacity: 0.5; }
}

/* ===== ERROR / SHAKE ================================================ */
.auth-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}
.auth-card.shake { animation: auth-shake 0.4s; }
@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card.shake { animation: none; }
}

/* ===== LINKS / FOOTER =============================================== */
.auth-forgot {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s;
}
.auth-forgot:hover { color: var(--auth-primary); }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.78rem;
    color: #94a3b8;
}
.auth-footer a {
    color: #64748b;
    text-decoration: none;
    margin: 0 0.3rem;
}
.auth-footer a:hover { color: var(--auth-primary); }
