:root {
    /* Colori Generali */
    --bg-color: #f8fafc;        
    --text-color: #334155;      
    
    /* Colori Sidebar (Menu) - CHIARI */
    --sidebar-bg: #ffffff;      
    --sidebar-text: #475569;    
    --sidebar-border: #e2e8f0;  
    
    --accent-color: #3b82f6;    
    --code-bg: #1e293b;         
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    overflow-x: hidden; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: block; 
    min-height: 100vh;
}

/* --- SIDEBAR (Menu Laterale) --- */
.sidebar {
    width: 280px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0; 
    left: 0;
    overflow-y: auto;
    padding: 20px 0;
    z-index: 3000; 
    transition: transform 0.3s ease;
    box-shadow: 2px 0 15px rgba(0,0,0,0.03);
}

.logo-container {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 20px;
    text-align: center;
}

.logo-container img { 
    max-width: 160px; 
    height: auto; 
    display: block;
    margin: 0 auto;
}

/* --- HEADER MOBILE (Nascosto su Desktop) --- */
.mobile-header {
    display: none; 
    background-color: var(--sidebar-bg);
    padding: 0 20px;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000; 
    height: 60px;
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.mobile-header img { height: 30px; }
.mobile-header button {
    background: none; border: none; color: var(--text-color); font-size: 24px; cursor: pointer; padding: 10px;
}

/* --- NAVIGAZIONE --- */
.nav-links { list-style: none; }

.nav-title {
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    padding: 15px 20px 5px 20px;
}
.nav-title.mt { margin-top: 15px; }

.nav-links li a {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s;
    border-left: 3px solid transparent;
}

.nav-links li a:hover, .nav-links li a.active {
    color: var(--accent-color);
    background-color: #eff6ff; 
    border-left-color: var(--accent-color);
    font-weight: 600;
}

/* --- CONTENUTO PRINCIPALE --- */
.content {
    margin-left: 280px; 
    padding: 60px 80px;
    width: auto; 
    max-width: 1200px;
    transition: opacity 0.3s ease-in-out; /* Aggiunta transizione */
    opacity: 1;
}

.content.fading {
    opacity: 0; /* Stato invisibile durante il cambio lingua */
}

.content section { 
    display: none;      /* Nasconde tutte le sezioni di default */
    opacity: 0; 
    transition: opacity 0.4s ease-in-out; 
    padding-bottom: 40px; /* Spazio in fondo prima di cambiare pagina */
}

/* Classe per inserire la sezione nel DOM */
.content section.active-section {
    display: block;
}

/* Classe per l'effetto Fade-in */
.content section.show-section {
    opacity: 1;
}

h1 { font-size: 42px; font-weight: 800; margin-bottom: 20px; letter-spacing: -1px; color: #0f172a; }
h2 { font-size: 28px; font-weight: 700; margin-bottom: 20px; color: var(--accent-color); padding-bottom: 10px; border-bottom: 1px solid var(--sidebar-border); }
h3 { font-size: 20px; font-weight: 600; margin: 30px 0 15px 0; color: #1e293b; }
p { margin-bottom: 15px; font-size: 16px; color: #334155; }
.lead { font-size: 20px; color: #64748b; font-weight: 300; margin-bottom: 30px; }

ul, ol { margin-left: 25px; margin-bottom: 20px; color: #334155; }
li { margin-bottom: 8px; }

.separator { border: 0; height: 1px; background: var(--sidebar-border); margin: 60px 0; }

/* Blocchi di Codice */
.code-block {
    background-color: var(--code-bg);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid #334155;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.code-block pre { margin: 0; }
.code-block code { color: #e2e8f0; font-family: monospace; font-size: 14px; }
p code, li code {
    background-color: #e2e8f0; color: #ef4444; padding: 2px 6px; border-radius: 4px; font-size: 14px; font-family: monospace;
}

footer { 
    text-align: center; margin-top: 80px; padding-top: 40px; 
    font-size: 12px; color: #94a3b8; border-top: 1px solid var(--sidebar-border); 
}

/* --- MULTILINGUA --- */
[data-lang] { display: none !important; }

body.lang-it [data-lang="it"],
body.lang-en [data-lang="en"],
body.lang-fr [data-lang="fr"],
body.lang-es [data-lang="es"],
body.lang-de [data-lang="de"] { 
    display: block !important; 
}

body.lang-it span[data-lang="it"],
body.lang-en span[data-lang="en"],
body.lang-fr span[data-lang="fr"],
body.lang-es span[data-lang="es"],
body.lang-de span[data-lang="de"] { 
    display: inline !important; 
}

/* Pulsantiera Lingue */
.lang-switcher {
    display: flex;
    gap: 6px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.lang-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s;
}

.lang-btn:hover { background: #e2e8f0; color: #0f172a; }

body.lang-it .btn-it, 
body.lang-en .btn-en, 
body.lang-fr .btn-fr, 
body.lang-es .btn-es, 
body.lang-de .btn-de {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.4);
}

/* --- RESPONSIVE / MOBILE --- */
@media (max-width: 850px) {
    .mobile-header { 
        display: flex; 
        z-index: 1000; 
    }
    .sidebar { 
        transform: translateX(-100%); 
        z-index: 3000; 
    }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; padding: 90px 20px 40px 20px; }
    
    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    
    .code-block { padding: 15px; margin: 15px -10px; border-radius: 4px; }
}


/* --- STILE LED ANIMATI --- */
.led {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.1);
}

.led-red { background-color: #ff0000; box-shadow: 0 0 8px #ff0000; }
.led-green { background-color: #00ff00; box-shadow: 0 0 8px #00ff00; }
.led-blue { background-color: #0000ff; box-shadow: 0 0 8px #0000ff; }

/* Animazione Lampeggio */
.blink { animation: led-blink 1s infinite; }
/* Animazione Flash Rapido */
.flash { animation: led-flash 2s infinite; }
/* Animazione Ciclo RGB */
.rgb-loop { animation: led-rgb 0.6s infinite; }

@keyframes led-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(0.9); }
}
@keyframes led-flash {
    0%, 90%, 100% { opacity: 0; }
    95% { opacity: 1; }
}
@keyframes led-rgb {
    0% { background: #ff0000; box-shadow: 0 0 8px #ff0000; }
    33% { background: #00ff00; box-shadow: 0 0 8px #00ff00; }
    66% { background: #0000ff; box-shadow: 0 0 8px #0000ff; }
}

/* --- SCREENSHOT DEL MANAGER --- */
.img-screenshot {
    width: 100%;
    max-width: 450px; 
    margin: 15px 0;
    border: 1px solid var(--sidebar-border);
    border-radius: 6px;
    display: block;
}

/* --- TABELLE COMPATIBILITA' (HTML) --- */
.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
    margin: 20px 0 35px 0;
}
.param-card {
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.param-header {
    background: #3b82f6; 
    color: #ffffff;
    text-align: center;
    font-weight: 700;
    padding: 8px;
    font-size: 14px;
}
.param-row {
    display: flex;
    border-bottom: 1px solid var(--sidebar-border);
}
.param-row:last-child { border-bottom: none; }
.param-brand {
    color: #f97316; 
    font-weight: 700;
    padding: 10px;
    width: 35%;
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
    background: rgba(0,0,0,0.02);
}
.param-models {
    padding: 10px;
    width: 65%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    color: var(--text-color);
}
.param-models span {
    display: block;
    width: 100%;
    text-align: center;
    padding: 2px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.param-models span:last-child { border-bottom: none; }

.param-req {
    padding: 10px;
    width: 100%;
    text-align: center;
    font-size: 13px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}
.param-req span { padding: 3px 0; border-bottom: 1px solid var(--sidebar-border); }
.param-req span:last-child { border-bottom: none; }

.param-note {
    color: #ef4444; 
    font-size: 11px;
    font-weight: 700;
    margin-top: 5px;
}

.param-footer {
    text-align: center;
    font-size: 11px;
    color: #10b981; 
    padding: 6px;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0,0,0,0.02);
    font-weight: 600;
}

/* Clearfix */
.clearfix::after {
    content: "";
    clear: both;
    display: table;
}

/* --- IMMAGINI FLOTTANTI (Effetto Overlay Elegante + Badge Zoom) --- */
.img-float-wrapper {
    float: left;
    width: 250px;
    margin: 5px 25px 5px 0;
    position: relative;
    cursor: zoom-in;
    border-radius: 8px;
    overflow: hidden; 
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.img-float-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

/* 1. Badge "Zoom" permanente in alto a destra */
.img-float-wrapper .zoom-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}
.img-float-wrapper .zoom-badge::before {
    content: "🔍"; /* Icona nel badge */
    font-size: 10px;
}

/* 2. Overlay scuro al passaggio del mouse */
.img-float-wrapper::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 3. Icona SVG grande al centro al passaggio del mouse */
.img-float-wrapper::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7' /%3E%3C/svg%3E");
    background-size: cover;
    z-index: 2;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Animazioni all'Hover (Solo Desktop) */
@media (hover: hover) and (pointer: fine) {
    .img-float-wrapper:hover::before,
    .img-float-wrapper:hover::after {
        opacity: 1;
    }
    .img-float-wrapper:hover::after {
        transform: translate(-50%, -50%) scale(1);
    }
    .img-float-wrapper:hover img {
        transform: scale(1.05); /* Zoom dell'immagine sotto */
    }
    .img-float-wrapper:hover .zoom-badge {
        opacity: 0; /* Nasconde il piccolo badge quando si passa il mouse */
    }
}

/* Su mobile annulliamo il float, i cursori, i badge e le animazioni hover */
@media (max-width: 600px) {
    .img-float-wrapper {
        float: none;
        width: 100%;
        max-width: 350px;
        margin: 0 auto 20px auto;
        cursor: default;
    }
    .img-float-wrapper::before,
    .img-float-wrapper::after,
    .img-float-wrapper .zoom-badge {
        display: none !important;
    }
}

/* --- LIGHTBOX (Zoom a schermo intero) --- */
#lightbox {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.85); 
    backdrop-filter: blur(5px);
    text-align: center;
}
#lightbox img {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    margin-top: 5vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s;
}
#lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}
@keyframes zoomIn { 
    from {transform:scale(0.8); opacity:0;} 
    to {transform:scale(1); opacity:1;} 
}

/* Barretta controllo */
.api-control-bar { display: flex; gap: 10px; background: var(--sidebar-border); padding: 10px; border-radius: 6px; margin: 10px 0; align-items: center; }
.test-btn { background: var(--accent-color); color: white; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; }

.json-viewer { font-family: monospace; font-size: 12px; }
.json-node { margin-left: 20px; }
.json-key { color: #f97316; font-weight: bold; }
.json-string { color: #22c55e; }
.json-number { color: #3b82f6; }
details { cursor: pointer; }
summary {
    color: #60a5fa;
    list-style: none; /* Rimuove la freccetta di default del browser */
    font-weight: bold;
    padding: 2px 0;
    transition: 0.2s;
}
summary:hover { color: #93c5fd; }

/* Triangolino personalizzato */
summary::before { 
    content: "▶"; 
    display: inline-block; 
    margin-right: 5px; 
    font-size: 10px; 
    transition: transform 0.2s; 
}
details[open] > summary::before { 
    transform: rotate(90deg); 
}

/* 1. Stile per i tag <code> semplici (quelli rossi in linea) */
/* Usiamo il selettore più semplice possibile */
p > code, li > code {
    background-color: #e2e8f0 !important; 
    color: #ef4444 !important; 
    padding: 2px 6px !important; 
    border-radius: 4px !important; 
    font-family: monospace !important;
    font-size: 14px !important;
}

/* 2. Stile per i blocchi Prism (solo se hanno la classe language-) */
pre code[class*="language-"] {
    background: transparent !important;
    display: block;
    padding: 0;
    font-size: 14px;
}

/* Forza lo sfondo del blocco <pre> esterno */
pre[class*="language-"] {
    background-color: #1e293b !important;
    padding: 20px !important;
    border-radius: 8px !important;
}

/* Container per gestire il tasto copia sopra il blocco <pre> */
.code-container {
    position: relative;
    margin: 0px 0;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #334155;
    color: #ffffff;
    border: 1px solid #475569;
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    opacity: 0.6;
}

.copy-btn:hover { opacity: 1; color: #fff; background: var(--accent-color); }
