/* =========================================
   FIX SCROLL ORIZZONTALE
   ========================================= */

body {
    overflow-x: hidden;
    max-width: 100vw;
}

img {
    max-width: 100%;
    height: auto;
}

/* =========================================
   NAVBAR — desktop
   ========================================= */

:root {
    --nav-text: #3a4a3a;
}

.navbar {
    background-color: #c8e6c8;
}

.navbar .navbar-brand {
    font-family: "Pompiere", cursive !important;
    font-size: clamp(0.85rem, 1.6vw, 1.3rem) !important;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--nav-text) !important;
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap;
}

.navbar > .container-fluid {
    flex-wrap: nowrap;
}

.navbar .nav-link,
.navbar .navBar-logo {
    color: var(--nav-text) !important;
    font-size: 1.05rem;
    white-space: nowrap;
}

.navbar .navbar-nav {
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.navbar .nav-item {
    flex-shrink: 0;
}

.navbar .nav-link {
    position: relative;
    text-decoration: none;
    padding-bottom: 4px;
}

.navbar .nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: #2e7d32;
    transition: width 0.25s ease;
}

.navbar .nav-link:hover::after,
.navbar .nav-link.show::after {
    width: 70%;
}

.navbar .dropdown-menu,
.navbar .dropdown-menu.show {
    background-color: #f4fbf4 !important;
    border: 1px solid #b2d8b2 !important;
    border-radius: 8px !important;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.12);
    --bs-dropdown-bg: #f4fbf4;
    --bs-dropdown-color: #3a4a3a;
    --bs-dropdown-link-color: #3a4a3a;
    --bs-dropdown-link-hover-bg: #c8e6c8;
    --bs-dropdown-link-hover-color: #1b3a1b;
}

.navbar .dropdown-item {
    color: #3a4a3a !important;
    background-color: transparent !important;
    font-size: 1.05rem;
    padding: 8px 18px;
    transition: background 0.15s;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    background-color: #c8e6c8 !important;
    color: #1b3a1b !important;
}

.navbar .dropdown-toggle::after {
    display: none;
}

/* =========================================
   MENU MOBILE — pannello laterale da destra
   ========================================= */

.navbar-toggler {
    box-shadow: none !important;
    border: none !important;
    padding: 0.25rem 0.5rem;
}

.navbar-toggler i {
    color: var(--nav-text);
}

#mobileMenu {
    /* telefono: stretto ma senza toccare i bordi */
    --bs-offcanvas-width: min(300px, 85vw);
    background-color: #fff8f0;
}

/* Cerchi decorativi sfumati sullo sfondo, per non lasciarlo troppo piatto.
   Li mettiamo sul body (non sull'intero offcanvas, che Bootstrap gestisce
   con position:fixed — sovrascriverlo romperebbe il posizionamento del drawer) */
#mobileMenu .offcanvas-body {
    position: relative;
    overflow-x: hidden;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
}

#mobileMenu .offcanvas-body::before,
#mobileMenu .offcanvas-body::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 230, 200, 0.55) 0%, rgba(200, 230, 200, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

#mobileMenu .offcanvas-body::before {
    width: 260px;
    height: 260px;
    top: -60px;
    right: -100px;
}

#mobileMenu .offcanvas-body::after {
    width: 220px;
    height: 220px;
    bottom: 15%;
    left: -110px;
}

/* i contenuti veri (link, bottone in fondo) devono stare sopra ai cerchi */
#mobileMenu .mobile-menu-links,
#mobileMenu .mobile-menu-bottom {
    position: relative;
    z-index: 1;
}

@media (min-width: 576px) {
    #mobileMenu {
        --bs-offcanvas-width: min(380px, 70vw);
    }
}

@media (min-width: 768px) {
    #mobileMenu {
        --bs-offcanvas-width: min(430px, 55vw);
    }
}

#mobileMenu .offcanvas-header {
    padding: 1.25rem 1rem 1.25rem 1.5rem;
    background-color: #c8e6c8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Titolo del drawer: il drawer sta fuori dal tag <nav>, quindi non eredita
   automaticamente ".navbar .navbar-brand" — lo impostiamo esplicitamente
   con lo stesso font della navbar desktop (Pompiere) ma senza grassetto */
#mobileMenu .offcanvas-header .navbar-brand {
    font-family: "Pompiere", cursive;
    font-weight: 700;
    font-size: 1.35rem !important;
    letter-spacing: 0.01em;
    color: var(--nav-text) !important;
    white-space: normal;
    line-height: 1.3;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

#mobileMenu .btn-close {
    flex-shrink: 0;
    background-color: #f4f6f4;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    opacity: 1;
    background-image: none;
    position: relative;
}

#mobileMenu .btn-close::before {
    content: "\F659"; /* bootstrap-icons X */
    font-family: "bootstrap-icons";
    font-size: 1rem;
    color: var(--nav-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mobile-menu-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mobile-menu-links li {
    list-style: none;
}

/* Voci del menu mobile: stesso font/peso delle voci del menu desktop
   (font di sistema, non grassetto), solo leggermente più grandi per
   comodità di tocco su schermo */
.mobile-menu-link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    position: relative;
    border-left: 3px solid transparent;
    transition:
        background-color 0.2s,
        color 0.2s,
        border-color 0.2s;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
    background-color: #e3f0e3;
    color: #1b3a1b;
    border-left-color: #2e7d32;
}

/* Sottomenu "Strumenti" ad accordion */
.mobile-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.mobile-submenu-toggle i {
    transition: transform 0.25s ease;
    font-size: 0.75rem;
}

.mobile-submenu-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.mobile-submenu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 0.75rem;
    margin: 0.2rem 0 0 0;
}

.mobile-submenu .mobile-menu-link {
    font-weight: 400;
    font-size: 0.95rem;
    color: #5a7a5a;
}

#mobileMenu .mobile-menu-bottom {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid #eef3ee;
}

#mobileMenu .mobile-menu-bottom .btn {
    width: 100%;
    padding: 0.65rem;
    font-size: 1rem;
}
