/* ============================================
   OFFICINA WEB — Foglio di stile
   Palette moderna: rosso accento + blu notte
   ============================================ */

/* ---- Variabili ---- */
:root {
    --accent: #E63946;
    --accent-dark: #c72c38;
    --ink: #1a1a2e;
    --night-1: #1a1a2e;
    --night-2: #16213e;
    --night-3: #0f3460;
    --text: #1a1a2e;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f4f5f7;
    --card-shadow: 0 4px 24px rgba(20,20,30,0.06);
    --card-shadow-lg: 0 20px 60px rgba(20,20,30,0.14);
    --radius: 12px;
    --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Base ---- */
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    letter-spacing: -0.3px;
}

/* ---- Shell: header / main / footer ---- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-logo img {
    height: 38px;
    display: block;
}

.app-header-link {
    font-size: 14px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}

    .app-header-link:hover {
        color: var(--accent);
    }

.app-main {
    flex: 1;
    width: 100%;
}

.app-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.app-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
}

    .app-footer-inner a {
        color: var(--muted);
    }

        .app-footer-inner a:hover {
            color: var(--accent);
        }

/* ---- Auth (login) ---- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    display: flex;
    width: 100%;
    max-width: 960px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--card-shadow-lg);
    min-height: 520px;
}

.auth-form {
    flex: 1.05;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand img {
    height: 40px;
    margin-bottom: 40px;
}

.auth-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--ink);
}

.auth-sub {
    font-size: 15px;
    color: var(--muted);
    margin: 0 0 32px;
    line-height: 1.6;
}

.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}

.auth-input-wrap {
    position: relative;
    margin-bottom: 8px;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0 14px 0 42px;
    height: 48px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .auth-input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
    }

.auth-btn {
    width: 100%;
    margin-top: 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 18px rgba(230,57,70,0.30);
    transition: background 0.15s, transform 0.1s;
}

    .auth-btn:hover {
        background: var(--accent-dark);
    }

    .auth-btn:active {
        transform: scale(0.98);
    }

    .auth-btn:disabled {
        opacity: 0.7;
        cursor: default;
    }

.auth-btn-arrow {
    font-size: 18px;
}

.auth-switch {
    font-size: 14px;
    color: var(--muted);
    margin: 28px 0 0;
    text-align: center;
}

    .auth-switch a {
        color: var(--accent);
        text-decoration: none;
        font-weight: 600;
    }

.auth-visual {
    flex: 1;
    position: relative;
    background-image: url('/officina_423x603.png');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 44px;
}

.auth-visual-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(26,26,46,0.55) 0%, rgba(15,52,96,0.85) 100%);
}

.auth-visual-accent {
    position: absolute;
    top: 40px;
    right: 44px;
    width: 34px;
    height: 4px;
    border-radius: 2px;
    background: var(--accent);
}

.auth-visual-text {
    position: relative;
    z-index: 1;
}

.auth-visual-title {
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.25;
}

.auth-visual-sub {
    color: #cdd8ea;
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

/* ---- Pagine card (registrazione, inserimento, area riservata) ---- */
.reg-container {
    max-width: 760px;
    margin: 40px auto;
    padding: 44px;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

    .reg-container h1 {
        font-size: 26px;
        font-weight: 600;
        margin: 0 0 8px;
        color: var(--ink);
    }

.msg-container {
    max-width: 560px;
    margin: 40px auto;
    padding: 44px;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

    .msg-container h1 {
        font-size: 26px;
        font-weight: 600;
        margin: 0 0 12px;
        color: var(--ink);
    }

    .msg-container .btn-primary {
        margin-top: 20px;
    }

.reg-sub {
    color: var(--muted);
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.6;
}

/* ---- Form ---- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
}

    .form-field label {
        font-weight: 600;
        margin-bottom: 6px;
        font-size: 0.88rem;
        color: var(--ink);
    }

.form-control {
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font);
}

    .form-control:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
    }

.form-check {
    margin: 22px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Bottoni ---- */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 26px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 6px 18px rgba(230,57,70,0.28);
    transition: background 0.15s, transform 0.1s;
}

    .btn-primary:hover {
        background: var(--accent-dark);
    }

    .btn-primary:active {
        transform: scale(0.98);
    }

    .btn-primary:disabled {
        opacity: 0.6;
        cursor: default;
        box-shadow: none;
    }

.btn-block {
    width: 100%;
    text-align: center;
}

/* ---- Messaggi / validazione ---- */
.alert-error {
    background: #fde8e8;
    color: #9b1c1c;
    padding: 11px 15px;
    border-radius: 10px;
    margin: 14px 0;
    font-size: 0.92rem;
}

.validation-message {
    color: var(--accent);
    font-size: 0.85rem;
}

.login-link {
    margin-top: 24px;
    color: var(--muted);
}

    .login-link a {
        color: var(--accent);
        text-decoration: none;
        font-weight: 600;
    }

/* ---- Overlay caricamento ---- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-box {
    text-align: center;
    padding: 32px 40px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--card-shadow-lg);
    max-width: 360px;
}

    .loading-box p {
        margin: 6px 0 0;
        font-weight: 600;
        color: var(--ink);
    }

.loading-sub {
    font-weight: 400 !important;
    color: var(--muted) !important;
    font-size: 0.9rem;
}

.spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border: 4px solid #eee;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Area riservata (lista analisi) ---- */
.azioni-top {
    margin: 24px 0;
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    background: #f7f8fa;
    border-radius: 14px;
    margin-top: 20px;
}

.tabella-analisi {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.95rem;
}

    .tabella-analisi th, .tabella-analisi td {
        text-align: left;
        padding: 13px 15px;
        border-bottom: 1px solid #eef0f2;
    }

    .tabella-analisi th {
        background: #f7f8fa;
        font-weight: 600;
        color: var(--ink);
    }

    .tabella-analisi tr:hover {
        background: #fafbfc;
    }

.btn-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

    .btn-link:hover {
        text-decoration: underline;
    }

/* ---- Report ---- */
.report-container {
    max-width: 760px;
    margin: 30px auto;
    padding: 0 20px;
}

.report-breadcrumb {
    margin-bottom: 16px;
}

    .report-breadcrumb a {
        color: var(--muted);
        text-decoration: none;
        font-size: 0.9rem;
    }

        .report-breadcrumb a:hover {
            color: var(--accent);
        }

.report-azioni {
    margin-bottom: 16px;
}

.report-doc {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

.report-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eef0f2;
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.report-officina {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
}

.report-meta {
    font-size: 13px;
    color: var(--muted);
    margin: 3px 0 0;
}

.report-brand {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
}

.report-potenziale {
    background: linear-gradient(135deg, var(--night-1), var(--night-3));
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 26px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rp-label {
    font-size: 13px;
    color: #cdd8ea;
    margin: 0;
    font-weight: 500;
}

.rp-sub {
    font-size: 13px;
    color: #9db2d4;
    margin: 4px 0 0;
}

.rp-value {
    font-size: 32px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.report-sintesi {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.sintesi-card {
    background: #f7f8fa;
    border-radius: 12px;
    padding: 14px 16px;
}

.sc-label {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.sc-value {
    font-size: 22px;
    font-weight: 600;
    margin: 4px 0 0;
    color: var(--ink);
}

.report-sezione {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin: 30px 0 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef0f2;
}

/* ---- Barre KPI ---- */
.kpi-riga {
    margin-bottom: 22px;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.kpi-nome {
    color: var(--ink);
    font-weight: 500;
}

.kpi-valori {
    color: #555;
}

.kpi-bench {
    color: #9ca3af;
}

.kpi-barra {
    position: relative;
    height: 22px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.banda {
    position: absolute;
    top: 0;
    height: 100%;
}

.banda-rossa {
    background: #f09595;
}

.banda-gialla {
    background: #fac775;
}

.banda-verde {
    background: #97c459;
}

.kpi-fill {
    position: absolute;
    left: 0;
    top: 5px;
    height: 12px;
    background: #2c2c2a;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.4);
    min-width: 2px;
}

.kpi-marker {
    position: absolute;
    top: -2px;
    height: calc(100% + 4px);
    width: 3px;
    background: var(--ink);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
}

.kpi-scala {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #9ca3af;
    margin-top: 3px;
}

/* ---- PDF: salto pagina ---- */
.page-break {
    break-before: page;
    -webkit-column-break-before: page;
    page-break-before: always;
}

/* ---- Blazor error UI (di sistema) ---- */
.validation-message {
    color: var(--accent);
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Si è verificato un errore.";
    }

/* ---- Responsive ---- */
@media (max-width: 800px) {
    .auth-form {
        padding: 40px 28px;
    }

    .auth-visual {
        display: none;
    }
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .report-sintesi {
        grid-template-columns: 1fr;
    }

    .app-header-inner, .app-footer-inner {
        padding: 10px 16px;
    }

    .app-logo img {
        height: 32px;
    }

    .reg-container, .report-doc {
        padding: 28px;
    }
}


h1:focus,
h1:focus-visible,
.auth-title:focus,
.auth-title:focus-visible {
    outline: none;
}


/* ---- Blocco sintesi strutturata ---- */
.report-lettura {
    background: #f7f8fa;
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 28px;
}

.rl-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.rl-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rl-verdetto {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.rl-ottima {
    color: #639922;
}

.rl-buona {
    color: #BA7517;
}

.rl-migliorabile {
    color: var(--accent);
}

.rl-potenziale {
    text-align: right;
}

.rl-pot-label {
    font-size: 11px;
    color: var(--muted);
    margin: 0;
}

.rl-pot-value {
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
    margin: 0;
}

.rl-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.rl-col-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 10px;
}

.rl-col-forza {
    color: #639922;
}

.rl-col-critica {
    color: var(--accent);
}

.rl-voce {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.rl-voce-nome {
    color: var(--ink);
}

.rl-voce-dett {
    color: var(--muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.rl-neg {
    color: var(--accent);
}

.rl-empty {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

.rl-finale {
    font-size: 13px;
    color: #444;
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .rl-cols {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .rl-head {
        flex-direction: column;
        gap: 10px;
    }

    .rl-potenziale {
        text-align: left;
    }
}

.campo-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}