/* ================================
   Soluzione Auto — Auth pages
   Brand: nero / navy + arancio #fd6d0d
   ================================ */

:root {
    --auth-accent: #fd6d0d;
    --auth-accent-hover: #e45f08;
    --auth-accent-soft: rgba(253, 109, 13, 0.14);
    --auth-ink: #0b1520;
    --auth-ink-soft: #334155;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
    --auth-surface: #ffffff;
    --auth-bg: #f4f6f8;
    --auth-panel: #071018;
    --auth-panel-2: #0f2433;
    --auth-radius: 20px;
    --auth-radius-sm: 12px;
    --auth-shadow: 0 24px 60px rgba(7, 16, 24, 0.18);
    --auth-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--auth-font);
    color: var(--auth-ink);
    background: var(--auth-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--auth-accent);
    text-decoration: none;
    transition: color .18s ease;
}

a:hover {
    color: var(--auth-accent-hover);
}

/* ---------- Shell / split layout ---------- */
.auth-shell,
.login-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    background: var(--auth-bg);
}

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 4vw, 3.5rem);
    color: #fff;
    background:
        radial-gradient(ellipse 80% 60% at 10% 10%, rgba(253, 109, 13, 0.35), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 90%, rgba(14, 165, 233, 0.18), transparent 50%),
        linear-gradient(155deg, var(--auth-panel) 0%, var(--auth-panel-2) 55%, #12293a 100%);
    overflow: hidden;
}

.auth-brand-panel::after {
    content: '';
    position: absolute;
    inset: auto -20% -30% auto;
    width: 70%;
    height: 70%;
    background: url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1'%3E%3Cpath d='M0 80h160M80 0v160'/%3E%3Ccircle cx='80' cy='80' r='40'/%3E%3Ccircle cx='80' cy='80' r='70'/%3E%3C/g%3E%3C/svg%3E") center/120px 120px;
    opacity: .9;
    pointer-events: none;
}

.auth-brand-kicker {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    width: fit-content;
    backdrop-filter: blur(8px);
}

.auth-brand-kicker i {
    color: var(--auth-accent);
}

.auth-brand-copy {
    position: relative;
    z-index: 1;
    max-width: 34rem;
    margin: 1.75rem 0 1.25rem;
}

.auth-brand-copy h1 {
    margin: 0 0 .55rem;
    font-size: clamp(1.55rem, 2.6vw, 2.15rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-brand-copy h1 span {
    color: var(--auth-accent);
}

.auth-brand-copy p {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: .98rem;
    line-height: 1.55;
    max-width: 32rem;
}

.auth-brand-wall {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    margin: 0 0 1.5rem;
    max-height: min(58vh, 520px);
    overflow: hidden;
    mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%);
}

.auth-brand-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 78px;
    padding: .55rem .4rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.auth-brand-tile:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(253, 109, 13, 0.45);
}

.auth-brand-tile img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    padding: 4px;
}

.auth-brand-tile-name {
    display: block;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.82);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .01em;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-brand-tile.is-fallback .auth-brand-tile-name {
    font-size: .78rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.auth-brand-foot {
    position: relative;
    z-index: 1;
    margin-top: auto;
    color: rgba(255, 255, 255, 0.45);
    font-size: .82rem;
}

/* ---------- Form panel ---------- */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    background:
        radial-gradient(circle at 100% 0%, rgba(253, 109, 13, 0.08), transparent 40%),
        linear-gradient(180deg, #f7f8fa 0%, #eef1f5 100%);
}

.login-card,
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--auth-surface);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: clamp(1.6rem, 3vw, 2.35rem);
    animation: authRise .55s ease-out;
}

@keyframes authRise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.logo-login {
    margin-bottom: 1rem;
}

.logo-login img {
    display: block;
    margin: 0 auto;
    max-width: 180px;
    max-height: 64px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.auth-card-header h1,
.auth-card-header h2,
.auth-card-header h3 {
    margin: 0 0 .4rem;
    font-size: 1.45rem;
    font-weight: 760;
    letter-spacing: -0.02em;
    color: var(--auth-title-color, var(--auth-ink));
}

.auth-card-header p {
    margin: 0;
    color: var(--auth-muted);
    font-size: .95rem;
}

/* ---------- Fields ---------- */
.auth-field {
    margin-bottom: 1rem;
}

.auth-field .form-label {
    display: block;
    margin-bottom: .45rem;
    font-size: .86rem;
    font-weight: 600;
    color: var(--auth-ink-soft);
}

.auth-input,
.login-card .form-control,
.login-card .form-select,
.auth-card .form-control,
.auth-card .form-select {
    width: 100%;
    min-height: 3rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    padding: .7rem 1rem;
    background: #fbfcfd;
    color: var(--auth-ink);
    font-size: .95rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.auth-input:focus,
.login-card .form-control:focus,
.login-card .form-select:focus,
.auth-card .form-control:focus,
.auth-card .form-select:focus {
    border-color: var(--auth-accent);
    background: #fff;
    box-shadow: 0 0 0 .2rem var(--auth-accent-soft);
    outline: none;
}

.auth-input-group,
.login-card .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.auth-input-group .form-control,
.auth-input-group .auth-input,
.login-card .input-group .form-control,
.login-card .input-group .auth-input {
    /* Evita width:100% che spinge l'occhiolino a capo */
    width: 1%;
    flex: 1 1 auto;
    min-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn-password-toggle {
    border: 1.5px solid var(--auth-border);
    border-left: 0;
    border-top-right-radius: var(--auth-radius-sm);
    border-bottom-right-radius: var(--auth-radius-sm);
    background: #fbfcfd;
    color: var(--auth-muted);
    flex: 0 0 3.1rem;
    width: 3.1rem;
    min-width: 3.1rem;
    min-height: 3rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease;
}

.input-group .btn-password-toggle:hover,
.input-group .btn-password-toggle.showing {
    color: var(--auth-accent);
    background: #fff;
}

.input-group .form-control:focus + .btn-password-toggle,
.input-group .auth-input:focus + .btn-password-toggle {
    border-color: var(--auth-accent);
    background: #fff;
}

/* ---------- Buttons ---------- */
.login-card .btn-primary,
.auth-card .btn-primary,
.btn-auth-submit,
#loginButton {
    min-height: 3.1rem;
    border-radius: var(--auth-radius-sm);
    border: none;
    background: var(--auth-accent) !important;
    border-color: var(--auth-accent) !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .01em;
    box-shadow: 0 10px 22px rgba(253, 109, 13, 0.28);
    transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.login-card .btn-primary:hover,
.auth-card .btn-primary:hover,
.btn-auth-submit:hover,
#loginButton:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(253, 109, 13, 0.34);
    background: var(--auth-accent-hover) !important;
    border-color: var(--auth-accent-hover) !important;
    color: #fff !important;
}

.login-card .btn-primary:active,
.auth-card .btn-primary:active,
.btn-auth-submit:active,
#loginButton:active {
    transform: translateY(0);
}

.login-card .btn-primary:disabled,
.auth-card .btn-primary:disabled,
.btn-auth-submit:disabled,
#loginButton:disabled {
    opacity: .7;
    transform: none;
    box-shadow: none;
}

.btn-google,
a.btn-google {
    min-height: 3rem;
    border-radius: var(--auth-radius-sm);
    border: 1.5px solid var(--auth-border);
    background: #fff;
    color: var(--auth-ink) !important;
    font-weight: 600;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.btn-google:hover,
a.btn-google:hover {
    background: #fafafa;
    border-color: #cbd5e1;
    color: var(--auth-ink) !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: 1.1rem 0;
    color: var(--auth-muted);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.login-links a {
    color: var(--auth-links-color, var(--auth-accent));
    font-weight: 600;
}

.login-links a:hover {
    color: var(--auth-links-hover, var(--auth-accent-hover));
}

.auth-footer-links {
    text-align: center;
    margin-top: .25rem;
}

.auth-footer-links .text-muted {
    color: var(--auth-muted) !important;
}

.auth-footer-links a.fw-bold {
    color: var(--auth-links-color, var(--auth-accent));
}

.auth-footer-links a.fw-bold:hover {
    color: var(--auth-links-hover, var(--auth-accent-hover));
}

.alert {
    border-radius: var(--auth-radius-sm);
    border: none;
    font-size: .9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

/* Compact mode when brand panel is hidden (register etc. still use card-only) */
.login-container:not(:has(.auth-brand-panel)) {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 0% 0%, rgba(253, 109, 13, 0.12), transparent 35%),
        radial-gradient(circle at 100% 100%, rgba(15, 36, 51, 0.12), transparent 40%),
        linear-gradient(160deg, #0b1520 0%, #13293a 45%, #1a3347 100%);
}

.login-container:not(:has(.auth-brand-panel)) .login-card {
    margin: 0 auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .auth-shell,
    .login-container:has(.auth-brand-panel) {
        grid-template-columns: 1fr;
    }

    /* Su mobile/tablet: solo il form di autenticazione */
    .auth-brand-panel {
        display: none !important;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: 1.25rem 1rem 2rem;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .login-card,
    .auth-card {
        padding: 1.35rem 1.15rem;
        border-radius: 16px;
        box-shadow: 0 14px 36px rgba(7, 16, 24, 0.14);
    }

    .logo-login img {
        max-width: 150px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card,
    .auth-card,
    .btn-auth-submit,
    #loginButton {
        animation: none;
        transition: none;
    }
}
