/* ═══════════════════════════════════════════════════════════════════════════
   Verbali on Line – Global Stylesheet
   Tutti gli stili sono centralizzati qui. Nessun <style> nei componenti Razor.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variabili ───────────────────────────────────────────────────────────── */
:root {
    --gesi-primary:      #1e2a78;
    --gesi-primary-alt:  #28367f;
    --gesi-primary-dark: #18235c;
    --gesi-text-dark:    #161b2e;
    --gesi-text-label:   #3a4255;
    --gesi-text-muted:   #8b91a5;
    --gesi-border:       #d8dcea;
    --gesi-input-icon:   #9aa1b4;
    --gesi-brand-bg:     #f4f6fc;
    --gesi-brand-border: #e6e9f5;
    --gesi-light:        #eef1fb;
}

/* ── Reset / base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: #212121;
    background-color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
    margin: 0;
}

h1:focus { outline: none; }

/* ── Link ────────────────────────────────────────────────────────────────── */
a { color: var(--gesi-primary); }
a:hover { color: var(--gesi-primary-alt); }

/* ── Bootstrap primary override ─────────────────────────────────────────── */
.btn-primary {
    color: #fff;
    background-color: var(--gesi-primary);
    border-color: var(--gesi-primary);
    transition: background-color 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--gesi-primary-alt);
    border-color: var(--gesi-primary-alt);
}

.btn-primary:focus,
.btn-primary:active:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 42, 120, 0.35);
}

/* ── Input group ─────────────────────────────────────────────────────────── */
.input-group-text {
    background-color: #f8f9fa;
    color: #495057;
}

/* ── Focus rings ─────────────────────────────────────────────────────────── */
.btn:focus, .btn:active:focus,
.form-control:focus, .form-check-input:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 42, 120, 0.25);
    border-color: var(--gesi-primary);
    outline: none;
}

/* ── Form validation ─────────────────────────────────────────────────────── */
.valid.modified:not([type=checkbox]) { outline: 1px solid #2e7d32; }
.invalid { outline: 1px solid #c62828; }
.validation-message { color: #c62828; font-size: 0.8rem; }

/* ── Blazor error boundary ───────────────────────────────────────────────── */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 8px;
}
.blazor-error-boundary::after {
    content: "Si è verificato un errore. Ricaricare la pagina.";
}

/* ── Scrollbar (webkit) ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #bdbdbd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9e9e9e; }

/* ── Animazioni ──────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.page-fade-in { animation: pageFadeIn 0.3s ease both; }
.fade-in      { animation: fadeIn 0.4s ease both; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH — Layout a due colonne (brand aside + form panel)
   ═══════════════════════════════════════════════════════════════════════════ */
.auth-layout-wrapper {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    font-family: 'Manrope', system-ui, sans-serif;
    color: var(--gesi-text-dark);
}

.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

/* ── Brand panel (aside sinistro) ───────────────────────────────────────── */
.auth-brand-panel {
    flex: 0 0 44%;
    max-width: 580px;
    background: var(--gesi-brand-bg);
    color: var(--gesi-primary);
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--gesi-brand-border);
}

.auth-brand-circle-lg {
    position: absolute;
    right: -80px;
    bottom: -80px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(30, 42, 120, 0.045);
    pointer-events: none;
}

.auth-brand-circle-sm {
    position: absolute;
    right: 50px;
    top: -60px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(30, 42, 120, 0.04);
    pointer-events: none;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
}

.auth-brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(160deg, #28367f, #18235c);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: none;
    box-shadow: 0 6px 16px rgba(30, 42, 120, 0.25);
}

.auth-brand-icon::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.13);
}

.auth-brand-icon span {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 600;
    font-size: 26px;
    color: #f7f5ef;
    line-height: 1;
}

.auth-brand-name {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--gesi-primary);
}

.auth-brand-hero {
    position: relative;
    max-width: 430px;
}

.auth-brand-hero h2 {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 500;
    font-size: 30px;
    line-height: 1.28;
    margin: 0 0 16px;
    letter-spacing: -0.01em;
    color: var(--gesi-primary);
}

.auth-brand-hero p {
    font-family: 'Manrope', sans-serif;
    font-size: 14.5px;
    line-height: 1.65;
    color: #6b7393;
    margin: 0;
}

.auth-brand-copyright {
    position: relative;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    color: #9aa0b8;
}

/* ── Form panel (main destro) ───────────────────────────────────────────── */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    overflow-y: auto;
}

.auth-form-container {
    width: 100%;
    max-width: 380px;
}

@media (max-width: 880px) {
    .auth-brand-panel { display: none !important; }
    .auth-form-panel  { padding: 32px 20px !important; }
}

/* ── Tipografia auth ────────────────────────────────────────────────────── */
.auth-form-title {
    font-weight: 800;
    font-size: 27px;
    color: var(--gesi-text-dark);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.auth-form-subtitle {
    font-size: 14px;
    color: var(--gesi-text-muted);
    line-height: 1.6;
    margin: 0 0 26px;
}

.auth-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gesi-text-label);
    margin: 0 0 7px;
}

.auth-field-link {
    font-size: 12px;
    color: var(--gesi-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-field-link:hover { text-decoration: underline; }

/* ── Input custom auth ──────────────────────────────────────────────────── */
.auth-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    border: 1px solid var(--gesi-border);
    border-radius: 11px;
    background: #fff;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input-wrapper:focus-within {
    border: 1.5px solid var(--gesi-primary);
    box-shadow: 0 0 0 3px rgba(30, 42, 120, 0.12);
}

.auth-input-wrapper > i {
    color: var(--gesi-input-icon);
    font-size: 16px;
    flex-shrink: 0;
}

.auth-input-wrapper:focus-within > i:first-child {
    color: var(--gesi-primary);
}

.auth-input,
.auth-input-wrapper input,
.auth-input-wrapper select {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 14.5px;
    color: #1a1f33;
    box-shadow: none;
}

.auth-input::placeholder,
.auth-input-wrapper input::placeholder {
    color: #aeb3c4;
}

.auth-input-wrapper .valid.modified,
.auth-input-wrapper .invalid {
    outline: none;
    box-shadow: none;
}

.auth-input-toggle {
    color: var(--gesi-input-icon);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.auth-input-toggle:hover {
    color: var(--gesi-primary);
}

/* ── Select custom auth ─────────────────────────────────────────────────── */
.auth-select-wrapper {
    display: flex;
    align-items: center;
    height: 48px;
    border: 1px solid var(--gesi-border);
    border-radius: 11px;
    background: #fff;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-select-wrapper:focus-within {
    border: 1.5px solid var(--gesi-primary);
    box-shadow: 0 0 0 3px rgba(30, 42, 120, 0.12);
}

.auth-select-wrapper select {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 14.5px;
    color: #1a1f33;
    box-shadow: none;
}

/* ── Bottone primario auth ──────────────────────────────────────────────── */
.auth-btn-primary {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 11px;
    background: var(--gesi-primary);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--gesi-primary-dark);
}

.auth-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.auth-btn-outline {
    width: 100%;
    height: 50px;
    border: 1.5px solid var(--gesi-border);
    border-radius: 11px;
    background: #fff;
    color: var(--gesi-text-label);
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.auth-btn-outline:hover:not(:disabled) {
    border-color: var(--gesi-primary);
    color: var(--gesi-primary);
}

/* ── OTP input ──────────────────────────────────────────────────────────── */
.auth-otp-input {
    display: block;
    width: 100%;
    text-align: center;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.5em;
    color: var(--gesi-primary);
    border: 1px solid var(--gesi-border);
    border-radius: 11px;
    height: 56px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-otp-input:focus {
    border-color: var(--gesi-primary);
    box-shadow: 0 0 0 3px rgba(30, 42, 120, 0.12);
}

.auth-otp-input::placeholder {
    color: #c9cddd;
    letter-spacing: 0.5em;
}

/* ── Icona circolare ────────────────────────────────────────────────────── */
.auth-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gesi-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-icon-circle i {
    font-size: 26px;
    color: var(--gesi-primary);
}

.auth-icon-circle-lg {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: var(--gesi-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-icon-circle-lg i {
    font-size: 29px;
    color: var(--gesi-primary);
}

/* ── Step indicator (2FA) ───────────────────────────────────────────────── */
.auth-step-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--gesi-border);
}

.auth-step-dot--active {
    background: var(--gesi-primary);
}

.auth-step-dot--done {
    background: #1f9d57;
}

.auth-step-line {
    width: 52px;
    height: 2px;
    background: var(--gesi-primary);
}

/* ── Link e footer auth ─────────────────────────────────────────────────── */
.auth-footer-link {
    text-align: center;
    font-size: 13.5px;
    color: var(--gesi-text-muted);
    margin: 24px 0 0;
}

.auth-footer-link-sm {
    text-align: center;
    font-size: 13px;
    color: var(--gesi-text-muted);
    margin: 10px 0 0;
}

.auth-link-bold {
    color: var(--gesi-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-link-bold:hover { text-decoration: underline; }

.auth-link-semibold {
    color: var(--gesi-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-link-semibold:hover { text-decoration: underline; }

.auth-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    font-size: 13.5px;
    color: var(--gesi-text-muted);
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--gesi-primary);
}

/* ── Password strength ──────────────────────────────────────────────────── */
.auth-password-strength .progress {
    height: 4px;
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — App shell (header fisso, sidebar fissa, solo main scrolla)
   ═══════════════════════════════════════════════════════════════════════════ */
.gesi-app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.gesi-app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.gesi-main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #f5f5f5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — Navbar
   ═══════════════════════════════════════════════════════════════════════════ */
.gesi-navbar {
    background-color: var(--gesi-primary);
    min-height: 60px;
    flex-shrink: 0;
}

.gesi-brand { text-decoration: none; }

.gesi-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(160deg, #28367f, #18235c);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: none;
    box-shadow: 0 4px 12px rgba(30, 42, 120, 0.3);
}

.gesi-logo-icon::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.13);
}

.gesi-logo-icon span {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 600;
    font-size: 20px;
    color: #f7f5ef;
    line-height: 1;
}

.gesi-logo-text {
    font-family: 'Spectral', Georgia, serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — Sidebar
   ═══════════════════════════════════════════════════════════════════════════ */
.gesi-sidebar {
    width: 240px;
    min-width: 240px;
    background-color: var(--gesi-primary);
    padding-top: 1.5rem !important;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.gesi-sidebar--collapsed {
    width: 60px;
    min-width: 60px;
}

.gesi-sidebar-link {
    color: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.gesi-sidebar-link:hover,
.gesi-sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.gesi-sidebar--collapsed .gesi-sidebar-link {
    justify-content: center;
    padding: 0.5rem;
}

.gesi-sidebar--collapsed .gesi-sidebar-label {
    display: none;
}

.gesi-sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    width: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.gesi-sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.gesi-sidebar--collapsed .gesi-sidebar-toggle {
    justify-content: center;
    padding: 0.5rem;
}

.gesi-offcanvas {
    background-color: var(--gesi-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPONENTE — StepIndicator (shared)
   ═══════════════════════════════════════════════════════════════════════════ */
.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: var(--gesi-light);
    color: #9fa8da;
    flex-shrink: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.step-circle.active {
    background-color: var(--gesi-primary);
    color: #ffffff;
}

.step-circle.completed {
    background-color: #2e7d32;
    color: #ffffff;
}

.step-connector {
    flex: 1;
    height: 2px;
    background-color: var(--gesi-light);
    transition: background-color 0.3s ease;
}

.step-connector.done {
    background-color: var(--gesi-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINA — Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */
.welcome-card {
    background: linear-gradient(135deg, var(--gesi-primary) 0%, var(--gesi-primary-alt) 100%);
    color: #ffffff;
    border-radius: 12px !important;
    animation: fadeSlideUp 0.35s ease both;
}

.welcome-card .text-muted  { color: rgba(255, 255, 255, 0.65) !important; }
.welcome-card .text-primary { color: #c5cae9 !important; }

.welcome-avatar {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1;
}

.stat-card {
    border-radius: 12px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeSlideUp 0.4s ease both;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212121;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: #757575;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.letter-spacing-1 { letter-spacing: 0.5px; }

/* ── Stato delle attività – griglia ──────────────────────────────────────── */
.activity-status-cell {
    border: 1px solid #e9ecef;
    border-left: 3px solid #bdbdbd;
    border-radius: 6px;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.activity-status-cell.phase-prep    { border-left-color: #78909c; }
.activity-status-cell.phase-active  { border-left-color: #1976d2; }
.activity-status-cell.phase-assign  { border-left-color: #f9a825; }
.activity-status-cell.phase-progress { border-left-color: #00897b; }
.activity-status-cell.phase-review  { border-left-color: #e65100; }
.activity-status-cell.phase-done    { border-left-color: #2e7d32; }

.activity-status-cell:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.activity-status-count {
    font-size: 1.35rem;
    font-weight: 700;
    color: #212121;
    line-height: 1.2;
}

.activity-status-label {
    font-size: 0.72rem;
    color: #757575;
    font-weight: 500;
    line-height: 1.3;
    margin-top: 2px;
}

.activity-status-cell.phase-prep .activity-status-count    { color: #546e7a; }
.activity-status-cell.phase-active .activity-status-count  { color: #1565c0; }
.activity-status-cell.phase-assign .activity-status-count  { color: #f57f17; }
.activity-status-cell.phase-progress .activity-status-count { color: #00796b; }
.activity-status-cell.phase-review .activity-status-count  { color: #d84315; }
.activity-status-cell.phase-done .activity-status-count    { color: #1b5e20; }

/* ═══════════════════════════════════════════════════════════════════════════
   ANAGRAFICA — Town typeahead
   ═══════════════════════════════════════════════════════════════════════════ */
.subject-town-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    max-height: 220px;
    overflow-y: auto;
}

.subject-town-suggestion-item {
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.subject-town-suggestion-item:last-child { border-bottom: none; }

.subject-town-suggestion-item:hover {
    background-color: var(--gesi-light);
}
