:root {
    --menu-width: 280px;
    --bg-sidebar: #0b3c7a;
    --blu-scuro: #0b3c7a;
    --titoli-scuri: #111827;
    --accento: #0072ff;
    --colore-pagina: #e5e7eb;
    --testo-scuro: #4b5563;
    --bianco: #ffffff;
    --font-titoli: 'Montserrat', sans-serif;
    --font-testo: 'Open Sans', sans-serif;
}

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

html {
    scroll-behavior: auto;
    overflow-x: hidden;
}

body {
    font-family: var(--font-testo);
    color: var(--testo-scuro);
    background-color: var(--colore-pagina);
    line-height: 1.7;
    font-size: 17px;
    margin: 0;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-titoli);
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

#layout-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar-fissa {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--menu-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    color: var(--bianco);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.logo-box {
    padding: 40px 30px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo-box h1 {
    font-size: 26px;
    line-height: 1.2;
    color: var(--bianco);
}

.logo-box h1 span {
    color: var(--accento);
}

.logo-box p {
    font-size: 13px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-top: 5px;
}

.nav-menu {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section h3 {
    color: #94a3b8;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.menu-section ul {
    list-style: none;
}

.menu-section li {
    margin-bottom: 4px;
}

.menu-section a {
    display: block;
    padding: 10px 10px 10px 25px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 15px;
    border-radius: 6px;
    position: relative;
}

.menu-section a.link-leaf::before,
.menu-section a.link-collapsed::before {
    content: "•" !important;
    position: absolute;
    left: 8px;
    top: 9px !important;
    font-size: 16px !important;
    color: var(--accento);
}

.menu-section a:hover,
.menu-section a.active {
    background-color: rgba(0, 80, 255, 0.15);
    color: var(--bianco);
}

.footer-sidebar {
    padding: 20px 30px;
    font-size: 12px;
    color: #cbd5e1;
    border-top: 1px solid rgba(255,255,255,0.05);
    line-height: 1.6;
}

#main-page {
    width: calc(100% - var(--menu-width));
    min-width: 0;
    margin-left: var(--menu-width);
}

.banner-carousel {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background-color: var(--titoli-scuri);
}

.slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    z-index: 1;
}

.slide-bg.active {
    opacity: 1;
    z-index: 2;
}

.banner-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(17, 24, 39, 0.9) 0%, rgba(17, 24, 39, 0.2) 100%);
    z-index: 3;
}

.banner-testo {
    position: absolute;
    top: 50%;
    left: 60px;
    transform: translateY(-50%);
    z-index: 4;
    max-width: 700px;
}

.banner-testo h2 {
    color: var(--bianco);
    font-size: 52px;
    line-height: 1.2;
    text-shadow: 2px 4px 15px rgba(0,0,0,0.4);
}

.page-content {
    padding: 50px;
}

.shadow-box {
    padding: 0;
    margin-bottom: 50px;
}

.titolo-sezione {
    color: var(--titoli-scuri);
    font-size: 30px;
    margin-bottom: 25px;
    border-bottom: 4px solid var(--accento);
    display: inline-block;
    padding-bottom: 5px;
    font-weight: 700;
}

.blocco-riquadri {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.riquadro {
    background: var(--bianco);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}

.riquadro-titolo {
    background-color: var(--blu-scuro);
    color: var(--bianco);
    padding: 20px;
    text-align: center;
    position: relative;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--accento);
    box-shadow: 0 0 8px rgba(0, 80, 255, 0.5);
}

.riquadro-slider {
    position: relative;
    height: 350px;
    background: #fff;
}

.slide-articolo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    display: flex;
    flex-direction: column;
    pointer-events: none;
}

.slide-articolo.active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

.foto-art {
    height: 200px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid #f3f4f6;
}

.testo-art {
    padding: 20px;
    flex-grow: 1;
}

.testo-art h4 {
    color: var(--titoli-scuri);
    margin-bottom: 8px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
}

.testo-art p {
    font-size: 14.5px;
    color: var(--testo-scuro);
    line-height: 1.5;
}

.lista-campi {
    list-style: none;
    padding-left: 0;
    margin-bottom: 25px;
}

.lista-campi li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    font-size: 18px;
    color: var(--testo-scuro);
}

.lista-campi li::before {
    content: "■";
    position: absolute;
    left: 0;
    color: var(--accento);
    font-size: 14px;
    top: 5px;
}

.blocco-footer {
    background-color: var(--bg-sidebar);
    color: var(--bianco);
    padding: 40px;
    border-radius: 12px;
}

.blocco-footer h3 {
    color: var(--accento);
    margin-bottom: 15px;
}

.blocco-footer a {
    color: var(--accento);
    text-decoration: none;
    font-weight: bold;
}

.instagram-container {
    display: flex !important;
    justify-content: center !important;
    width: 100%;
}

.instagram-container iframe,
.instagram-container .instagram-media {
    margin: 0 auto !important;
}

.badge-categoria {
    display: inline-block;
    background-color: var(--accento);
    color: var(--bianco);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.titolo-articolo {
    display: block;
    color: var(--titoli-scuri);
    font-size: 42px;
    margin-bottom: 30px;
    line-height: 1.2;
    font-family: var(--font-titoli);
    font-weight: 700;
    overflow-wrap: break-word;
}

.articolo-corpo {
    color: var(--testo-scuro);
    width: 100%;
    max-width: 100%;
    overflow: visible;
    overflow-wrap: break-word;
}

.articolo-corpo img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.articolo-corpo .articolo-canvas img {
    max-width: none;
    height: 100%;
    border-radius: 0;
    margin: 0;
}

.galleria-container {
    margin-bottom: 40px;
}

.galleria-merged-box {
    background-color: var(--bianco);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0px 0px 25px 5px rgba(17, 24, 39, 0.08);
    border: 1px solid rgba(0,0,0,0.03);
}

.galleria-main {
    position: relative;
    width: 100%;
    height: 550px;
    overflow: hidden;
}

.galleria-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.galleria-track img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.didascalia-foto {
    width: 100%;
    text-align: center;
    font-size: 16.5px;
    font-weight: 600;
    color: var(--titoli-scuri);
    padding: 20px 40px;
    font-family: var(--font-testo);
    min-height: 67px;
    margin-top: 0;
    border: none;
    box-shadow: none;
}

.thumbnail-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.galleria-btn {
    background: #111827;
    color: var(--bianco);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    flex-shrink: 0;
    transition: transform 0.2s ease, background 0.2s ease;
}

.galleria-btn:hover {
    background: #000000;
    transform: scale(1.1);
}

.galleria-thumbnails {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px;
    scrollbar-width: none;
    max-width: 100%;
}

.galleria-thumbnails::-webkit-scrollbar {
    display: none;
}

.galleria-thumbnails img {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.galleria-thumbnails img:hover {
    opacity: 0.8;
}

.galleria-thumbnails img.active {
    opacity: 1;
    border-color: var(--accento);
    transform: scale(1.15);
}

.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.95);
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 2px solid var(--accento);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--accento);
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: rgba(255,255,255,0.5);
    border: none;
    font-size: 60px;
    cursor: pointer;
    padding: 20px;
}

.lightbox-btn:hover {
    color: white;
}

.lightbox-btn.prev {
    left: 20px;
}

.lightbox-btn.next {
    right: 20px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.map-container {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    height: 350px;
    width: 100%;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.highlight-email {
    display: inline-block;
    background-color: rgba(0, 80, 255, 0.08);
    color: var(--accento);
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 22px;
    margin: 10px 0;
    border: 1px solid rgba(0, 80, 255, 0.15);
    overflow-wrap: anywhere;
}

.highlight-email:hover {
    background-color: rgba(0, 80, 255, 0.15);
    transform: translateY(-2px);
}

.form-slider-wrapper {
    background-color: var(--bianco);
    border-radius: 16px;
    box-shadow: 0px 0px 25px 5px rgba(17, 24, 39, 0.08);
    border: 1px solid rgba(0,0,0,0.03);
    padding: 50px;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.form-slider-track {
    display: flex;
    width: 100%;
}

.form-slide {
    flex: 0 0 100%;
    width: 100%;
    padding: 0 10px;
}

.form-slide h3 {
    color: var(--titoli-scuri);
    font-size: 26px;
    margin-bottom: 10px;
}

.form-slide p {
    margin-bottom: 25px;
}

.form-input {
    width: 100%;
    padding: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 17px;
    font-family: var(--font-testo);
    color: var(--titoli-scuri);
    background-color: #f9fafb;
}

.form-input:focus {
    border-color: var(--accento);
    outline: none;
    background-color: var(--bianco);
}

textarea.form-input {
    resize: vertical;
    min-height: 150px;
}

.form-nav-area {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 50px;
    position: relative;
}

.form-nav-btn {
    background: #111827;
    color: var(--bianco);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    position: absolute;
}

.form-nav-btn:hover {
    background: #000000;
    transform: scale(1.1);
}

.form-nav-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

.form-nav-btn.prev {
    left: 0;
}

.form-nav-btn.next {
    right: 0;
}

.form-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #cbd5e1;
}

.form-dot.active {
    width: 35px;
    border-radius: 10px;
    background-color: var(--accento);
}

.btn-submit {
    background-color: var(--accento);
    color: var(--bianco);
    padding: 16px 32px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: inline-block;
    font-family: var(--font-titoli);
    box-shadow: 0 4px 12px rgba(0, 80, 255, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
}

.btn-submit:hover {
    background-color: #003cc2;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 80, 255, 0.4);
}

.hamburger-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--bg-sidebar);
    color: var(--bianco);
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    z-index: 998;
}

.sidebar-close-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: calc(var(--menu-width) + 12px);
    z-index: 1002;
    background: rgba(255,255,255,0.15);
    color: var(--bianco);
    border: 2px solid rgba(255,255,255,0.3);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

body.sidebar-open .sidebar-close-btn {
    display: flex;
}

.articolo-canvas {
    position: relative;
    width: 1000px;
    max-width: none;
    min-height: 400px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--bianco);
    border-radius: 12px;
}

.articolo-canvas .canvas-el {
    position: absolute;
    box-sizing: border-box;
}

.articolo-canvas .canvas-content {
    width: 100%;
}

.articolo-canvas .canvas-text .canvas-content {
    width: 100%;
    min-height: 30px;
    font-family: var(--font-testo);
    color: var(--testo-scuro);
    font-size: 17px;
    line-height: 1.7;
}

.articolo-canvas .canvas-text .canvas-content h1,
.articolo-canvas .canvas-text .canvas-content h2,
.articolo-canvas .canvas-text .canvas-content h3,
.articolo-canvas .canvas-text .canvas-content h4 {
    font-family: var(--font-titoli);
    color: var(--titoli-scuri);
    line-height: 1.2;
}

.articolo-canvas .canvas-text .canvas-content p {
    margin-top: 0;
    margin-bottom: 18px;
}

.articolo-canvas .canvas-text .canvas-content ul,
.articolo-canvas .canvas-text .canvas-content ol {
    padding-left: 30px;
}

.articolo-canvas .canvas-text .canvas-content blockquote {
    margin: 20px 0;
}

.articolo-canvas .canvas-img {
    overflow: hidden;
}

.articolo-canvas .canvas-img .canvas-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.articolo-canvas .canvas-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
    border-radius: 0;
    max-width: none;
}

@media (max-width: 1100px) {
    .page-content {
        padding: 35px;
    }

    .banner-testo {
        left: 40px;
        max-width: calc(100% - 80px);
    }

    .banner-testo h2 {
        font-size: 42px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    #layout-container {
        display: block;
        width: 100%;
        min-height: 100vh;
    }

    #sidebar-fissa {
        position: fixed;
        top: 0;
        left: 0;
        width: min(280px, 85vw);
        max-width: 280px;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    body.sidebar-open #sidebar-fissa {
        transform: translateX(0);
    }

    #main-page {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        min-height: 100vh;
        padding-top: 60px;
        overflow-x: hidden;
    }

    .hamburger-btn {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.55);
        z-index: 999;
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .sidebar-close-btn {
        position: fixed;
        top: 15px;
        left: calc(min(280px, 85vw) + 12px);
        z-index: 1002;
    }

    .nav-menu {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .footer-sidebar {
        flex-shrink: 0;
    }

    .page-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 15px;
    }

    .articolo-corpo {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .articolo-canvas {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0;
        overflow: hidden;
    }
    
    .articolo-canvas .canvas-el {
        position: static !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        margin: 0 0 20px 0;
    }

    .articolo-canvas .canvas-text {
        max-width: 100%;
        overflow: hidden;
    }

    .articolo-canvas .canvas-text .canvas-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    
    .articolo-canvas .canvas-img .canvas-content {
        height: auto;
    }

    .articolo-canvas .canvas-text .canvas-content p,
    .articolo-canvas .canvas-text .canvas-content h1,
    .articolo-canvas .canvas-text .canvas-content h2,
    .articolo-canvas .canvas-text .canvas-content h3,
    .articolo-canvas .canvas-text .canvas-content h4,
    .articolo-canvas .canvas-text .canvas-content li {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .articolo-canvas .canvas-img {
        height: auto !important;
    }

    .articolo-canvas .canvas-img img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 20px 12px;
    }

    .banner-carousel {
        height: 210px;
    }

    .banner-testo {
        left: 15px;
        right: 15px;
    }

    .banner-testo h2 {
        font-size: 25px;
    }

    .titolo-articolo {
        font-size: 25px;
    }

    .titolo-sezione {
        font-size: 21px;
    }

    .riquadro-slider {
        height: 310px;
    }

    .foto-art {
        height: 165px;
    }

    .galleria-main {
        height: 230px;
    }

    .galleria-btn {
        width: 34px;
        height: 34px;
    }

    .galleria-thumbnails img {
        width: 44px;
        height: 44px;
    }

    .form-slider-wrapper {
        padding: 20px 12px;
    }

    .form-nav-area {
        margin-top: 35px;
    }

    .form-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .articolo-corpo {
        font-size: 15.5px;
    }

    .blocco-footer {
        padding: 22px 16px;
    }
}