/* ================================================================================= */
/* FOGLIO STILE KALEO - V1.0                                                         */
/* By Cacciatore AI                                                                  */
/* ================================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* --- PALETTE COLORI --- */
:root {
    --primary: #2563eb;
    --primary-focus: #1d4ed8;
    --primary-gradient: linear-gradient(to right, #3b82f6, #2563eb);
    --primary-content: #ffffff;
    --secondary: #64748b;
    --accent: #f59e0b;
    --neutral: #1f2937;
    --base-100: #ffffff;
    --base-200: #f3f4f6;
    --base-300: #e5e7eb;
    --text-dark: var(--neutral);
    --text-muted: #4b5563;
    --error: #ef4444;
    --success: #16a34a;
    --border-radius: 0.5rem;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --transition-speed: 0.2s ease-in-out;
}

body { 
    background-color: var(--base-200); 
    color: var(--text-dark); 
    font-size: 15px; 
    line-height: 1.6; 
    overflow-x: hidden;
}

/* --- LAYOUT SIDEBAR --- */
.app-layout { display: flex; }
.sidebar {
    width: 250px;
    background-color: var(--base-100);
    height: 100dvh;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    transition: width var(--transition-speed), transform var(--transition-speed);
    border-right: 1px solid var(--base-300);
    z-index: 1001;
}
.sidebar-header { flex-shrink: 0; font-size: 1.5rem; font-weight: 700; padding: 1rem; color: var(--primary); }
.sidebar .menu { flex-grow: 1; overflow-y: auto; }
.sidebar-profile { flex-shrink: 0; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--base-300); }
.main-content-wrapper { flex-grow: 1; transition: margin-left var(--transition-speed); margin-left: 250px; }
.header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--base-300);
    display: flex;
    align-items: center;
    height: 4rem;
    position: sticky;
    top: 0;
    z-index: 900;
}
.main-content { padding: 1.5rem; }

/* Stato Collassato */
.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .sidebar-header, .sidebar.collapsed .menu span, .sidebar.collapsed .user-info, .sidebar.collapsed #logout-button span { display: none; }
.sidebar.collapsed .menu a, .sidebar.collapsed #logout-button { justify-content: center; }
.main-content-wrapper.collapsed { margin-left: 80px; }

/* Mobile */
@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background-color: rgba(0,0,0,0.5); z-index: 999; }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    .main-content-wrapper { margin-left: 0; }
    #sidebar-toggle-desktop { display: none; }
    #sidebar-toggle-mobile { display: flex; }
}
@media (min-width: 769px) {
    #sidebar-toggle-mobile { display: none; }
}

/* --- COMPONENTI UI --- */
.menu { list-style: none; }
.menu a { color: var(--text-muted); display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--border-radius); font-weight: 500; transition: background-color 0.2s, color 0.2s; white-space: nowrap; }
.menu a:hover { background-color: var(--base-200); color: var(--text-dark); }
.menu a.active { background: var(--primary-gradient); color: var(--primary-content); box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3); }
.divider { height: 1px; background-color: var(--base-300); margin: 0.5rem 0; }
.card { background-color: var(--base-100); border-radius: var(--border-radius); box-shadow: var(--shadow-soft); border: 1px solid var(--base-300); }
.card-body { padding: 1.5rem; }
.card-title { font-size: 1.25rem; font-weight: 600; border-bottom: 1px solid var(--base-300); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1.2rem; border-radius: var(--border-radius); font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--transition-speed); }
.btn-primary { background: var(--primary-gradient); color: var(--primary-content); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2); }
.btn-primary:disabled { background: var(--secondary); cursor: not-allowed; }
.btn-secondary { background-color: var(--base-200); color: var(--text-dark); border-color: var(--base-300); }
.btn-secondary:hover { background-color: var(--base-300); }
.btn-ghost { background-color: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background-color: var(--base-200); color: var(--text-dark); }
.input, .select, .choices__inner { width: 100%; border: 1px solid var(--base-300) !important; background-color: var(--base-100) !important; padding: 0.6rem 0.75rem !important; border-radius: var(--border-radius) !important; transition: all var(--transition-speed); font-family: inherit; font-size: 15px; }
.input:focus, .select:focus, .choices__inner:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--primary) !important; }
.form-control { margin-bottom: 1.5rem; }
.label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-muted); }
.hidden { display: none !important; }
.avatar .placeholder { background-color: var(--primary); color: var(--primary-content); width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; border-radius: 9999px; font-weight: 600; }
.user-info { display: flex; flex-direction: column; white-space: nowrap; }
.password-container { position: relative; }
.password-container .input { padding-right: 2.5rem; }
.toggle-password { position: absolute; top: 50%; right: 0.75rem; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); user-select: none; }

/* --- STILI LOGIN PAGE --- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

/* --- STILI WIZARD PREVENTIVO --- */
.step-navigation-bar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; padding: 0 1rem; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--secondary); transition: color var(--transition-speed); position: relative; flex: 1; cursor: default; }
.step-circle { width: 32px; height: 32px; border-radius: 50%; background-color: var(--base-300); color: var(--secondary); display: flex; align-items: center; justify-content: center; font-weight: 600; transition: all var(--transition-speed); border: 2px solid var(--base-300); }
.step-name { font-size: 0.8rem; font-weight: 500; margin-top: 0.5rem; }
.step.completed { cursor: pointer; color: var(--text-dark); }
.step.completed .step-circle { background-color: var(--success); color: white; border-color: var(--success); }
.step.active .step-circle { background-color: white; border-color: var(--primary); color: var(--primary); }
.step.active { color: var(--primary); font-weight: 600; }
.step-connector { height: 2px; background-color: var(--base-300); flex-grow: 1; margin: 16px -2rem 0; }
.form-section-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 1.5rem; }
.form-subsection-title { font-size: 1.1rem; font-weight: 600; margin-top: 2rem; margin-bottom: 1rem; border-top: 1px solid var(--base-300); padding-top: 1.5rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.D-1-col { grid-column: span 1; }
.D-2-col { grid-column: span 2; }
.D-3-col { grid-column: span 3; }
.D-4-col { grid-column: span 4; }
@media(max-width: 768px) { .form-grid { grid-template-columns: 1fr; } .D-1-col, .D-2-col, .D-3-col, .D-4-col { grid-column: span 1; } }
.wizard-navigation { display: flex; justify-content: space-between; margin-top: 2rem; border-top: 1px solid var(--base-300); padding-top: 1.5rem; }
.radio-group { display: flex; gap: 1.5rem; align-items: center; padding-top: 0.5rem; }
.radio-group label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.capitalize { text-transform: capitalize; }
.uppercase-input { text-transform: uppercase; }
.uppercase-input::placeholder { text-transform: none; }
.form-message-area { margin-top: 1.5rem; padding: 1rem; border-radius: var(--border-radius); text-align: center; font-weight: 500; }
.form-message-area.success { background-color: #dcfce7; color: #15803d; }
.form-message-area.error { background-color: #fee2e2; color: #b91c1c; }
.loading-spinner { display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 1s linear infinite; margin-right: 0.5rem; }
.btn .loading-spinner { border-color: white; border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Riepilogo */
.riepilogo-container { display: grid; gap: 1.5rem; }
.riepilogo-box { background-color: var(--base-200); padding: 1.5rem; border-radius: var(--border-radius); }
.riepilogo-box h3 { font-size: 1.1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--base-300); padding-bottom: 0.75rem; }
.riepilogo-box p { margin-bottom: 0.5rem; }

