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

:root {
    --sidebar-width: 260px;
    --primary-color: #2c3e50; /* Blu Architetto scuro */
    --accent-color: #3498db;  /* Blu Accento */
    --bg-body: #f8f9fa;
    --text-main: #333;
    --card-radius: 8px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

/* =========================
   SIDEBAR STRUTTURA
   ========================= */
.sidebar {
    width: var(--sidebar-width);
    background: #1e293b; /* Slate molto scuro */
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    padding: 0;
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

/* Header */
.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding-left: 25px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i { color: var(--accent-color); font-size: 1.5rem; margin-right: 10px; }
.sidebar-header span { color: white; font-weight: 600; font-size: 1.1rem; letter-spacing: 0.5px; }

/* Label sezioni (es. COMMERCIALE) */
.sidebar .nav-label {
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 25px 25px 10px;
}

/* =========================
   SIDEBAR NAVIGATION
   ========================= */
.sidebar .nav-link {
    color: #cbd5e1;
    padding: 14px 25px;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
    
    /* Flexbox per allineare icona e testo */
    display: flex;
    align-items: center;
    width: 100%; /* Occupa tutto lo spazio */
    text-align: left; /* Forza allineamento a sinistra */
}

/* Icona sinistra (es. speedometer) */
.sidebar .nav-link i:first-child { 
    width: 24px; 
    font-size: 1.1rem; 
    margin-right: 10px; 
    opacity: 0.8; 
    text-align: center;
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.05);
    border-left-color: var(--accent-color);
}
.sidebar .nav-link:hover i:first-child { opacity: 1; color: var(--accent-color); }

/* FRECCIA DROPDOWN (Solo per i dropdown-toggle) */
.sidebar .dropdown-toggle {
    justify-content: space-between; /* Spinge la freccia a destra */
}

.sidebar .dropdown-toggle::after {
    margin-left: auto;
    transition: transform 0.2s;
    /* Opzionale: usa un'icona chevron invece del triangolo default */
    /* content: "\F282"; font-family: "bootstrap-icons"; border: none; */
}

.sidebar .dropdown-toggle.show::after {
    transform: rotate(180deg);
}

/* =========================
   SOTTOMENU (ACCORDION FIX)
   ========================= */
.sidebar .dropdown-menu {
    position: static !important; /* Smette di galleggiare */
    transform: none !important;
    float: none;
    width: 100%;
    background-color: #0f172a; /* Sfondo più scuro */
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 5px 0;
    box-shadow: inset 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.sidebar .dropdown-menu.show {
    display: block;
}

.sidebar .dropdown-item { 
    color: #94a3b8; 
    padding: 10px 20px 10px 58px; /* Indentazione precisa per allinearsi al testo sopra */
    font-size: 0.9rem;
    transition: all 0.2s;
    display: block; /* Occupa tutta la riga */
}

.sidebar .dropdown-item:hover { 
    color: #fff; 
    background-color: rgba(255,255,255,0.05); 
    padding-left: 63px; /* Effetto slide hover */
}


/* =========================
   MAIN CONTENT
   ========================= */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    padding: 30px 40px;
    width: 100%;
    max-width: 100%;
}

/* =========================
   COMPONENTI UI (ARCHITETTO STYLE)
   ========================= */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    background: #fff;
    margin-bottom: 25px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 18px 25px;
    font-weight: 600;
    font-size: 1.05rem;
    color: #334155;
}

.card-body { padding: 25px; }

/* Tabelle */
.table { vertical-align: middle; }
.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px;
}
.table td { padding: 15px; color: #334155; border-bottom: 1px solid #f1f5f9; }

/* Form */
.form-label { color: #64748b; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.form-control, .form-select {
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
}
.form-control:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); }

/* Bottoni */
.btn {
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-primary { background-color: var(--accent-color); border-color: var(--accent-color); }
.btn-primary:hover { background-color: #2980b9; }


/* --- MODERN FORM STYLING (Architect Grade) - AGGIUNTA NUOVA --- */

/* Card Editor "Galleggiante" */
.editor-card {
    border: none;
    border-radius: 16px; /* Molto arrotondato */
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08); /* Ombra morbida */
    background: #ffffff;
    overflow: hidden;
}

.editor-header {
    background: #ffffff;
    padding: 20px 25px;
    border-bottom: 1px solid #f1f5f9;
}

.editor-title {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #1e293b;
    display: flex;
    align-items: center;
}

.editor-body {
    padding: 25px;
}

/* Input Moderni (Sovrascrittura specifica per editor) */
.input-group-text {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 10px 0 0 10px !important;
    color: #64748b;
}

/* Form Control Moderno */
.form-control, .form-select {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px !important;
    padding: 12px 15px;
    font-size: 0.95rem;
    color: #334155;
    transition: all 0.2s ease-in-out;
}

/* Fix per Input Group (Input attaccato all'icona) */
.input-group .form-control {
    border-radius: 0 10px 10px 0 !important;
    border-left: none;
}

/* Focus State (Effetto Glow) */
.form-control:focus, .form-select:focus {
    background-color: #ffffff;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
    outline: none;
}

/* Labels Pulite */
.modern-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

/* Bottone Principale */
.btn-action-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
    width: 100%;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    color: white;
}