/* inCOD Optimized Mobile Menu Styles */

/* Wrapper to fix Elementor conflicts */
.incod-optimized-mobile-menu-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    max-width: 1200px;
    padding: 0 20px;
    box-sizing: border-box;
    min-height: 1px; /* Fix for flexbox/min-height issue in Elementor */
}

/* Fix for Elementor column alignment */
.elementor-column .incod-optimized-mobile-menu-wrapper {
    max-width: 100%;
    padding: 0;
}

.elementor-element .incod-optimized-mobile-menu-wrapper {
    margin-bottom: 20px;
}

/* Hamburger Menu Styles */
.hamburger-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 15px;
    cursor: pointer;
    z-index: 1000;
    color: var(--hamburger-icon-color, #1d2327);
    position: absolute;
    right: 20px;
    top: 20px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    width: calc(var(--hamburger-icon-size, 24px) + 20px);
    height: calc(var(--hamburger-icon-size, 24px) + 20px);
    min-width: 44px;
    min-height: 44px;
}

.hamburger-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.hamburger-menu:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* When menu is open: fixed top-right above the overlay (like original) */
.hamburger-menu.is-open {
    position: fixed;
    top: 40px;
    right: 20px;
    z-index: 10000000;
}

.hamburger-menu.is-open:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hamburger-icon {
    width: var(--hamburger-icon-size, 24px);
    height: var(--hamburger-icon-size, 24px);
    position: relative;
    display: block;
    color: var(--hamburger-icon-color, #1d2327);
}

.hamburger-icon .hamburger-img,
.hamburger-icon .hamburger-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hamburger-icon .hamburger-img {
    object-fit: contain;
}

/* CSS drawn hamburger (fallback) */
.hamburger-icon .hamburger-top,
.hamburger-icon .hamburger-middle,
.hamburger-icon .hamburger-bottom {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 2px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.hamburger-icon .hamburger-top {
    top: 0px;
}

.hamburger-icon .hamburger-middle {
    top: calc(50% - 1px);
}

.hamburger-icon .hamburger-bottom {
    bottom: 0;
}

/* Close Icon (X) — hidden by default, shown when menu is open */
.hamburger-icon .close-icon {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: transparent;
    background-image: none;
    border: none;
    border-radius: 0;
    opacity: 1;
    transform: none;
    padding: 0;
    box-sizing: border-box;
}

.hamburger-icon .close-icon .close-svg,
.hamburger-icon .close-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hamburger-menu.is-open .hamburger-img,
.hamburger-menu.is-open .hamburger-svg,
.hamburger-menu.is-open .hamburger-top,
.hamburger-menu.is-open .hamburger-middle,
.hamburger-menu.is-open .hamburger-bottom {
    display: none;
}

.hamburger-menu.is-open .hamburger-icon .close-icon {
    display: block;
}

/* Mobile Menu Overlay — FULL SCREEN (like original megamenu) */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 110px 20px 120px; /* Abundant padding for scroll */
    box-sizing: border-box;
    background-color: var(--menu-bg-color, #2c2c2c);
    color: rgba(255, 255, 255, 0.7);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.mobile-menu-overlay.active {
    display: block;
}

body.mobile-menu-open,
html.mobile-menu-open {
    overflow: hidden;
    height: 100%;
}

/* Menu Container */
.mobile-menu-container {
    position: relative;
    width: 100%;
}

/* Menu Navigation */
.mobile-menu-nav {
    display: block;
    width: 100%;
    max-width: none;
    margin-left: 0;
    box-shadow: none;
    padding-top: 0;
    padding-bottom: 0;
    height: auto;
    overflow: visible;
    background: transparent;
}

/* Mobile slider — flex track approach (like original) */
.mobile-menu-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: block;
    z-index: 1001;
}

/* The track holds all panels side-by-side */
#mobile-panels-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    transition: transform .35s ease-in-out;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Each panel takes exactly 100% of the slider width */
.mobile-menu-panel {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    padding-bottom: 40px;
    box-sizing: border-box;
}

/* Back button (percorso: torna al livello precedente) */
.mobile-menu-back {
    display: block;
    margin: 0 0 0 auto;
    background: none;
    border: 0;
    padding: 13px 12px 0 12px;
    border-radius: 6px;
    color: #CBCBCB;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    text-decoration-line: underline;
    cursor: pointer;
    font-family: inherit;
}

.mobile-menu-back:hover {
    color: var(--link-hover-color, #0098a0);
}

/* Panel subtitle (parent item title) */
.mobile-menu-panel-title {
    margin-bottom: 10px;
    color: #CBCBCB;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    text-transform: uppercase;
}

/* Main Menu List */
.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-list li {
    margin: 0;
    list-style: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 0;
}

.mobile-menu-list li::before {
    display: none;
}

.mobile-menu-list li:last-child {
    border-bottom: none;
}

.mobile-menu-link {
    display: block;
    color: var(--link-color, #ffffff);
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    text-decoration-line: underline !important;
    text-underline-position: from-font;
    text-transform: capitalize;
    padding: 13px 25px;
    border-radius: 30px;
    margin: 0 0 5px 0;
    transition: ease .3s ease-out;
    position: relative;
    background: transparent;
    border: none;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    cursor: pointer;
}

.mobile-menu-link:hover {
    color: var(--link-hover-color, #0098a0);
}

.submenu-arrow {
    float: right;
    transition: transform .4s ease-out;
    display: inline-block;
    line-height: inherit;
}

/* Hidden submenu — source data for the panel slider (cloned by JS) */
.mobile-submenu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Contact Section */
.mobile-contacts {
    display: block;
    padding: 20px 0;
    position: relative;
    width: 100%;
    margin-top: 20px;
}

.mobile-contacts-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

/* Button Styles */
.mobile-button {
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.mobile-button--info {
    background-color: var(--info-button-bg, #0098a0);
    color: var(--info-button-text, #ffffff);
}

.mobile-button--info:hover {
    background-color: var(--info-button-hover-bg, #007c88);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 152, 160, 0.3);
}

.mobile-button--call {
    background-color: var(--call-button-bg, #ffffff);
    color: var(--call-button-text, #2c2c2c);
}

.mobile-button--call:hover {
    background-color: var(--call-button-hover-bg, #f0f0f0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Social Links */
.mobile-social-links {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    list-style: none;
    margin: 0;
}

.mobile-social-links li a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    transition: color 0.3s ease;
}

.mobile-social-links li a:hover {
    color: var(--link-hover-color, #0098a0);
}

/* No menu message */
.no-menu {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    padding: 13px 25px;
}

/* Scroll Styling */
.mobile-menu-overlay::-webkit-scrollbar {
    width: 6px;
}

.mobile-menu-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-menu-overlay::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger-menu {
        top: 15px;
        right: 15px;
    }

    .hamburger-menu.is-open {
        top: 20px;
        right: 15px;
    }

    .mobile-menu-overlay {
        padding: 90px 20px 100px;
    }

    .mobile-button {
        min-width: 140px;
        font-size: 13px;
        padding: 10px 20px;
    }

    .mobile-menu-link {
        padding-left: 25px;
        padding-right: 25px;
    }
}
