/* =============================================
   SIDEBAR MANUALE D'USO
   ============================================= */
.manual-sidebar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--admin-primary, #FF6200);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--admin-primary, #FF6200);
}

.sidebar-nav {
    margin: 0;
    padding: 0;
}

/* ---- Livello 1: sezioni root ---- */
.nav-section {
    margin-bottom: 0.25rem;
}

.section-header {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    transition: background 0.2s;
}

.section-header:hover {
    background: #ffe8d6;
}

.section-title {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-title:hover,
.section-title.active {
    color: var(--admin-primary, #FF6200);
    text-decoration: none;
}

.section-toggle {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: #999;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.section-toggle i {
    display: inline-block;
    transition: transform 0.2s;
}

.nav-section.expanded > .section-header .section-toggle i {
    transform: rotate(180deg);
}

.section-items {
    list-style: none;
    padding: 0.25rem 0 0.25rem 0.75rem;
    margin: 0;
    display: none;
}

.section-items.show {
    display: block;
}

/* ---- Livello 2: items foglia e rami ---- */
.nav-item {
    margin: 0.1rem 0;
}

.nav-item > a,
.nav-item.depth-1 > a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.nav-item > a:hover {
    background: #ffe8d6;
    color: var(--admin-primary, #FF6200);
    padding-left: 1rem;
    text-decoration: none;
}

.nav-item.active > a {
    background: var(--admin-primary, #FF6200);
    color: #fff;
    font-weight: 600;
}

/* ---- Ramo (branch) ---- */
.nav-branch .branch-header {
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-branch .branch-header:hover {
    background: #ffe8d6;
}

.nav-branch .branch-header a {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.75rem;
    color: #444;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-branch .branch-header a:hover,
.nav-branch .branch-header a.active {
    color: var(--admin-primary, #FF6200);
    text-decoration: none;
}

.branch-toggle {
    flex-shrink: 0;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    color: #aaa;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

.branch-toggle i {
    display: inline-block;
    transition: transform 0.2s;
}

.nav-branch.expanded > .branch-header .branch-toggle i {
    transform: rotate(180deg);
}

/* ---- Livello 3: items foglia dentro un ramo ---- */
.branch-items {
    list-style: none;
    padding: 0.15rem 0 0.15rem 0.75rem;
    margin: 0;
    display: none;
    border-left: 2px solid #e9ecef;
    margin-left: 0.75rem;
}

.branch-items.show {
    display: block;
}

.branch-items .nav-item > a,
.nav-item.depth-2 > a {
    font-size: 0.825rem;
    padding: 0.35rem 0.6rem;
    color: #666;
}

.branch-items .nav-item > a:hover {
    background: #ffe8d6;
    color: var(--admin-primary, #FF6200);
    padding-left: 0.85rem;
}

.branch-items .nav-item.active > a {
    background: var(--admin-primary, #FF6200);
    color: #fff;
    font-weight: 600;
}

/* =============================================
   CONTENUTO ARTICOLO
   ============================================= */
.manual-article {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.manual-article h1,
.manual-article h2,
.manual-article h3,
.manual-article h4 {
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.manual-article h1:first-child,
.manual-article h2:first-child {
    margin-top: 0;
}

.manual-article h2 {
    color: var(--admin-primary, #FF6200);
    border-bottom: 2px solid var(--admin-primary, #FF6200);
    padding-bottom: 0.5rem;
}

.manual-article img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.manual-article code {
    background: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
}

.manual-article pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.manual-article pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.manual-article table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

.manual-article table th,
.manual-article table td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
}

.manual-article table th {
    background: #f8f9fa;
    font-weight: 600;
}

.manual-article blockquote {
    border-left: 4px solid var(--admin-primary, #FF6200);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #666;
}

.manual-article ul,
.manual-article ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.manual-article li {
    margin: 0.5rem 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991px) {
    .manual-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 2rem;
    }

    .manual-article {
        padding: 1.5rem;
    }
}
