/* ============================================================
   Gateway Page — Pagina di accesso rapido
   Layout split-screen: sinistra brand, destra login
   Usata quando homepage_mode = 'gateway'
   ============================================================ */

/* ---- Variabili locali (fallback su variabili tema) ---- */
:root {
    --gw-primary:       var(--color-primary, #c2410c);
    --gw-primary-dark:  var(--color-primary-hover, #9a3412);
    --gw-primary-rgb:   var(--color-primary-rgb, 194 65 12);
    --gw-font:          'DM Sans', var(--font-family, system-ui, sans-serif);
    --gw-font-display:  'Playfair Display', Georgia, serif;
    --gw-radius:        var(--radius-md, 4px);
    --gw-shadow:        0 20px 60px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.06);
    --gw-panel-bg:      #ffffff;
    --gw-left-text:     #ffffff;
    --gw-transition:    0.2s ease;
}

/* ---- Reset base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.gateway-body {
    font-family: var(--gw-font);
    background: var(--color-bg, #f8fafc);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   LAYOUT SPLIT-SCREEN
   ============================================================ */
.gw-layout {
    display: grid;
    grid-template-columns: 1fr 480px;
    min-height: 100vh;
}

/* ============================================================
   COLONNA SINISTRA
   ============================================================ */
.gw-left {
    position: relative;
    background: var(--gw-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(255,255,255,.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(0,0,0,.15) 0%, transparent 50%);
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.gw-left-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 3.5rem 4rem;
    flex: 1;
}

/* Logo */
.gw-brand { margin-bottom: 3rem; }

.gw-logo-img {
    max-height: 52px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: .92;
}

.gw-logo-fallback {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: var(--gw-left-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    border: 1.5px solid rgba(255,255,255,.3);
}

/* Copy */
.gw-copy { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.gw-eyebrow {
    font-family: var(--gw-font);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255,255,255,.65);
    margin-bottom: 1rem;
}

.gw-headline {
    font-family: var(--gw-font-display);
    font-size: clamp(2.2rem, 3.5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--gw-left-text);
    margin-bottom: 1.25rem;
    letter-spacing: -.02em;
}

.gw-desc {
    font-size: .95rem;
    line-height: 1.7;
    color: rgba(255,255,255,.78);
    max-width: 34ch;
}

/* Info footer sinistra */
.gw-left-footer {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding-top: 2.5rem;
    border-top: 1px solid rgba(255,255,255,.15);
    margin-top: 3rem;
}

.gw-info-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
    color: rgba(255,255,255,.6);
}

.gw-info-item svg { flex-shrink: 0; opacity: .7; }

/* Decorazioni geometriche */
.gw-left-deco {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.gw-deco-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.08);
}

.gw-deco-circle--1 {
    width: 480px; height: 480px;
    bottom: -120px; right: -80px;
    background: rgba(255,255,255,.03);
}
.gw-deco-circle--2 {
    width: 280px; height: 280px;
    top: -60px; right: 40px;
    background: rgba(0,0,0,.06);
}
.gw-deco-circle--3 {
    width: 160px; height: 160px;
    top: 40%; left: -40px;
    background: rgba(255,255,255,.04);
}

/* Hero image opzionale */
.gw-hero-img-wrap {
    position: absolute;
    bottom: 0; right: 0;
    width: 55%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.gw-hero-img {
    width: 100%;
    height: 75%;
    object-fit: cover;
    object-position: top center;
    opacity: .18;
    mix-blend-mode: luminosity;
}

/* ============================================================
   COLONNA DESTRA — Pannello login
   ============================================================ */
.gw-right {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
}

.gw-panel {
    background: var(--gw-panel-bg);
    border-radius: 12px;
    box-shadow: var(--gw-shadow);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 380px;
    animation: gw-slide-up .4s ease both;
}

@keyframes gw-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Logo mobile (nascosta su desktop) */
.gw-mobile-brand {
    display: none;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f1f1;
}

.gw-logo-img--sm { max-height: 36px; filter: none; opacity: 1; }

.gw-logo-fallback--sm {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--gw-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    border: none;
}

.gw-mobile-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text, #1e293b);
}

/* ---- Titoli pannello ---- */
.gw-panel-title {
    font-family: var(--gw-font);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text, #1e293b);
    margin-bottom: .3rem;
    letter-spacing: -.01em;
}

.gw-panel-sub {
    font-size: .84rem;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ---- Greeting utente loggato ---- */
.gw-auth-greeting {
    font-size: .92rem;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 1.5rem;
}

.gw-auth-greeting strong { color: var(--color-text, #1e293b); }

/* ---- Form ---- */
.gw-form { display: flex; flex-direction: column; gap: 1.1rem; }

.gw-field { display: flex; flex-direction: column; gap: .35rem; }

.gw-label-text {
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-text, #374151);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.gw-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gw-forgot {
    font-size: .75rem;
    color: var(--gw-primary);
    text-decoration: none;
    font-weight: 500;
}
.gw-forgot:hover { text-decoration: underline; }

.gw-input-wrap { position: relative; }

.gw-input {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--gw-radius);
    font-family: var(--gw-font);
    font-size: .9rem;
    color: var(--color-text, #1e293b);
    background: #fff;
    transition: border-color var(--gw-transition), box-shadow var(--gw-transition);
    outline: none;
    -webkit-appearance: none;
}

.gw-input-wrap .gw-input { padding-right: 2.8rem; }

.gw-input:focus {
    border-color: var(--gw-primary);
    box-shadow: 0 0 0 3px rgba(var(--gw-primary-rgb), .12);
}

.gw-input::placeholder { color: #aab; }

/* Occhio mostra/nascondi password */
.gw-eye {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: .2rem;
    display: flex;
    align-items: center;
    transition: color var(--gw-transition);
}
.gw-eye:hover { color: var(--gw-primary); }

/* ---- Bottoni ---- */
.gw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .72rem 1.25rem;
    font-family: var(--gw-font);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--gw-radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--gw-transition);
    letter-spacing: .01em;
}

.gw-btn--primary {
    background: var(--gw-primary);
    color: #fff;
    border-color: var(--gw-primary);
}
.gw-btn--primary:hover {
    background: var(--gw-primary-dark);
    border-color: var(--gw-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--gw-primary-rgb), .3);
}

.gw-btn--submit { margin-top: .25rem; }

.gw-btn--outline {
    background: transparent;
    color: var(--gw-primary);
    border-color: #e2e8f0;
}
.gw-btn--outline:hover {
    border-color: var(--gw-primary);
    background: rgba(var(--gw-primary-rgb), .04);
}

.gw-btn--ghost {
    background: transparent;
    color: #94a3b8;
    border-color: #e9ecef;
    font-size: .85rem;
}
.gw-btn--ghost:hover { color: var(--gw-primary); border-color: var(--gw-primary); }

/* ---- Divisore ---- */
.gw-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
    color: #b0bec5;
    font-size: .78rem;
}
.gw-divider::before,
.gw-divider::after { content: ''; flex: 1; height: 1px; background: #edf0f3; }

/* ---- Footer powered ---- */
.gw-powered {
    margin-top: 1.75rem;
    text-align: center;
    font-size: .72rem;
    color: #b0bec5;
}
.gw-powered a { color: var(--gw-primary); text-decoration: none; font-weight: 500; }
.gw-powered a:hover { text-decoration: underline; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: riduce la colonna destra */
@media (max-width: 1024px) {
    .gw-layout { grid-template-columns: 1fr 420px; }
    .gw-left-inner { padding: 2.5rem 2.5rem; }
    .gw-headline { font-size: clamp(2rem, 4vw, 2.8rem); }
}

/* Mobile: una colonna sola, login centrato */
@media (max-width: 720px) {
    .gw-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    /* Sinistra: strip orizzontale compatta */
    .gw-left {
        padding: 0;
        min-height: 0;
    }

    .gw-left-inner {
        padding: 1.5rem 1.5rem 1rem;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .gw-brand { margin-bottom: 0; flex-shrink: 0; }
    .gw-logo-fallback { width: 40px; height: 40px; font-size: 1rem; }
    .gw-logo-img { max-height: 36px; }

    .gw-copy { flex: 1; min-width: 0; }
    .gw-eyebrow { display: none; }
    .gw-headline { font-size: 1.1rem; margin-bottom: .2rem; }
    .gw-desc { display: none; }
    .gw-left-footer { display: none; }

    .gw-left-deco { display: none; }

    /* Destra: piena larghezza */
    .gw-right {
        align-items: flex-start;
        padding: 1.5rem 1rem 2rem;
        background: #f8fafc;
    }

    .gw-panel {
        max-width: 100%;
        border-radius: 8px;
        padding: 1.75rem 1.5rem;
        box-shadow: 0 4px 20px rgba(0,0,0,.08);
    }

    .gw-mobile-brand { display: none; } /* nascosta: la strip sinistra la sostituisce */
}
