/*
 * Theme Name:  Hello Elementor Child
 * Description: Alpesoft Master 2030 — Clean Slate Rebuild
 * Template:    hello-elementor
 * Version:     9.1.0
 */

/* ══════════════════════════════════
   TOKENS
   ══════════════════════════════════ */
:root {
    --brand-blue:   #3d7abf; 
    --brand-green:  #3a9e5f; 
    --brand-orange: #e06b1f; 
    --tech-dark:    #1a2030; 
    --tech-navy:    #0f1420; 
    --tech-gray:    #f5f7fa; 
    --white:        #ffffff;
    --text-main:    #2d3748;
    --text-dim:     #718096;
    --sidebar-w:    300px;
    --top-bar-h:    40px;
    --ease:         cubic-bezier(.4,0,.2,1);
    --ease-out:     cubic-bezier(0,.55,.45,1);
}

/* ══════════════════════════════════
   RESETS & BASE
   ══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--white);
    color: var(--text-main);
    line-height: 1.6;
    padding-right: var(--sidebar-w);
    padding-top: var(--top-bar-h);
}
a { text-decoration: none; color: inherit; transition: color 0.3s; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ══════════════════════════════════
   TOP BAR
   ══════════════════════════════════ */
.top-bar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--top-bar-h);
    background: var(--tech-navy);
    z-index: 9999;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 calc(var(--sidebar-w) + 20px) 0 20px;
    color: var(--white); font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.top-bar-logo { 
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    display: flex; 
    align-items: center; 
    z-index: 100;
}
.custom-logo-link img { height: auto !important; width: auto !important; max-height: 24px !important; max-width: 160px !important; object-fit: contain !important; }
.top-bar-contacts { display: flex; gap: 20px; flex: 1; justify-content: center; overflow: hidden; }
.top-bar-contacts a { color: #ffffff !important; text-decoration: none; font-weight: 500; opacity: 1; white-space: nowrap; font-size: 12px; filter: brightness(2); }
.top-bar-contacts a:hover { color: var(--brand-blue) !important; }
.top-bar-langs { display: flex; gap: 15px; }
.top-bar-langs a { color: var(--white); opacity: 0.6; font-size: 11px; font-weight: 700; text-decoration: none; }
.top-bar-langs a.is-active, .top-bar-langs a:hover { opacity: 1; color: var(--white); }

/* ══════════════════════════════════
   SIDEBAR RIGHT
   ══════════════════════════════════ */
.sidebar-right {
    position: fixed; top: var(--top-bar-h); right: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--tech-navy);
    z-index: 999999 !important; /* Elevazione estrema */
    display: block; 
    border-left: 1px solid rgba(255,255,255,0.05);
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    overflow-y: auto !important;
    padding-bottom: 120px !important;
    overscroll-behavior: contain !important;
    pointer-events: all !important; /* Forza cattura mouse */
    touch-action: pan-y;
}
.sidebar-top-favicon {
    padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; justify-content: center; align-items: center;
}
.sidebar-top-favicon img { width: auto !important; height: auto !important; max-width: 32px !important; max-height: 32px !important; filter: drop-shadow(0 0 5px var(--brand-blue)); }

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0; padding: 0; position: relative; }

.sidebar-link {
    display: flex !important;
    flex-direction: row !important; /* Forza orizzontale */
    align-items: center;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--text-dim);
    font-weight: 500;
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 2px 10px;
    white-space: nowrap; /* Evita a capo strani */
}

.sidebar-link:hover {
    background: rgba(61, 122, 191, 0.08);
    color: var(--brand-blue);
}

.sidebar-link.is-active {
    background: var(--brand-blue);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(61, 122, 191, 0.3);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    flex-shrink: 0; /* Impedisce schiacciamento icona */
}

.sidebar-label {
    flex: 1;
    text-align: left; /* Allinea a sinistra */
}

/* --- Submenu Logic (Accordion) --- */
.sidebar-nav .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    width: 100%;
}

/* Mostra sottomenu se il genitore è attivo o hover - FORZATO */
.sidebar-nav li:hover > .sub-menu,
.sidebar-nav li.current-menu-ancestor > .sub-menu,
.sidebar-nav li.current-menu-parent > .sub-menu,
.sidebar-nav li.is-active > .sub-menu,
.sidebar-nav li.current-menu-item > .sub-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
}

/* Stile sottomenu */
.sub-menu .sidebar-link {
    padding: 8px 12px 8px 52px !important;
    font-size: 14px !important;
    min-height: auto !important;
    opacity: 0.8;
    background: transparent !important;
    box-shadow: none !important;
}

.sub-menu .sidebar-link:hover {
    opacity: 1;
    color: var(--brand-blue) !important;
    transform: translateX(2px);
}

/* Toggle Icon rotation */
li:hover .submenu-toggle-icon,
li.current-menu-ancestor .submenu-toggle-icon,
li.current-menu-parent .submenu-toggle-icon,
li.is-active .submenu-toggle-icon {
    transform: rotate(180deg);
    opacity: 1;
}

.sub-menu li a {
    display: block !important;
    padding: 10px 20px 10px 45px !important; /* Rientro a destra dell'icona */
    color: rgba(255,255,255,0.6) !important;
    font-size: 13px !important;
    text-transform: none !important;
    text-align: left !important;
    border: none !important;
    min-height: auto !important;
}

.sub-menu li a:hover {
    color: var(--brand-blue) !important;
    background: transparent !important;
}

.sidebar-icon { margin-bottom: 6px; display: flex; align-items: center; justify-content: center; }
.sidebar-icon svg { width: 22px; height: 22px; stroke: currentColor; }
.sidebar-label { 
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; 
    font-weight: 600; opacity: 0.8; display: block; 
    text-align: center; line-height: 1.3; padding: 0 8px;
    word-wrap: break-word;
}
.sidebar-right { padding-bottom: 120px !important; }
.sidebar-nav { padding-bottom: 80px; }
/* Icon Colors */
.sidebar-link[data-slug="crm"] .sidebar-icon { color: var(--brand-green); }
.sidebar-link[data-slug="cms"] .sidebar-icon { color: var(--brand-blue); }
.sidebar-link[data-slug="prodotti"] .sidebar-icon { color: var(--brand-orange); }

/* ══════════════════════════════════
   MOBILE DRAWER
   ══════════════════════════════════ */
/* ══════════════════════════════════
   MOBILE NAVIGATION (HAMBURGER & DRAWER)
   ══════════════════════════════════ */
body .hamburger-btn {
    display: none !important; /* Nascosto su Desktop */
    position: fixed !important; top: 10px !important; right: 20px !important;
    background: var(--brand-blue) !important; 
    border: none !important; 
    border-radius: 4px !important;
    width: 40px !important; height: 40px !important; 
    z-index: 2000000 !important; cursor: pointer !important;
    flex-direction: column !important; align-items: center !important; justify-content: center !important; 
    gap: 4px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
}

.top-bar-logo img { 
    height: 24px !important; 
    width: auto !important; 
    object-fit: contain;
}

/* Fix per sezioni Elementor che ignorano il padding del body */
.elementor-section-stretched {
    width: calc(100vw - var(--sidebar-w)) !important;
    left: 0 !important;
}

.top-bar {
    padding: 0 calc(var(--sidebar-w) + 20px) 0 20px !important;
}
body .hamburger-btn span { display: block !important; width: 22px !important; height: 2px !important; background: #fff !important; transition: 0.3s !important; }

/* Drawer Elements - High Specificity Force */
body .mobile-drawer-overlay {
    position: fixed !important; inset: 0 !important; background: rgba(0,0,0,0.8) !important; z-index: 110000 !important;
    display: none !important; opacity: 0 !important; transition: opacity 0.3s !important;
}
body .mobile-drawer-overlay.is-visible { display: block !important; opacity: 1 !important; }

body .mobile-drawer {
    position: fixed !important; top: 0 !important; bottom: 0 !important; right: -320px !important; width: 300px !important;
    background: var(--tech-navy) !important; z-index: 999999 !important; 
    transition: right 0.4s var(--ease) !important;
    padding: 50px 30px 150px 30px !important; color: #fff !important; 
    display: block !important; 
    box-shadow: -15px 0 50px rgba(0,0,0,0.6) !important;
    transform: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    pointer-events: all !important;
    touch-action: pan-y;
}
body .mobile-drawer.is-open { right: 0 !important; }

.drawer-header { display: flex !important; justify-content: space-between !important; align-items: center !important; margin-bottom: 50px !important; }
.drawer-header img { height: 26px !important; width: auto !important; }
.drawer-close { background: none !important; border: none !important; color: #fff !important; font-size: 38px !important; cursor: pointer !important; }

.drawer-nav { display: block !important; padding-bottom: 120px !important; }
.drawer-nav a { 
    display: block !important; padding: 18px 0 !important; color: #fff !important; font-size: 18px !important; 
    border-bottom: 1px solid rgba(255,255,255,0.06) !important; text-decoration: none !important; transition: 0.3s !important;
}
.drawer-nav a:hover { color: var(--brand-blue) !important; padding-left: 8px !important; }

/* Infinity Lines Background */
.master-hero, .infinity-bg {
    position: relative;
    overflow: hidden;
    background-color: #f7f9fc;
}
.master-hero::before, .infinity-bg::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(61, 122, 191, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(61, 122, 191, 0.1) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center bottom;
    perspective: 800px;
    perspective-origin: 50% 0%;
    transform: perspective(800px) rotateX(75deg) scale(3) translateY(-10%);
    transform-origin: top center;
    opacity: 0.8;
    pointer-events: none;
}
@keyframes slideLines {
    from { background-position: center 0; }
    to { background-position: center 60px; }
}
.master-hero::before {
    animation: slideLines 20s linear infinite;
}
@media (max-width: 1300px) {
    body .hamburger-btn { display: flex !important; }
    body { padding-right: 0 !important; padding-top: var(--top-bar-h) !important; }
    .sidebar-right { display: none !important; }
    .top-bar { padding: 0 15px !important; }
    .desktop-only-langs, .top-bar-langs { display: none !important; }
    
    /* Mobile Drawer Custom Fix for Sidebar Walker */
    .drawer-nav .sidebar-link {
        flex-direction: row !important;
        justify-content: flex-start !important;
        min-height: 60px !important;
        padding-left: 0 !important;
        gap: 20px !important;
        border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    }
    .drawer-nav .sidebar-icon { margin-bottom: 0 !important; }
    .drawer-nav .sidebar-label { 
        font-size: 16px !important; 
        text-align: left !important; 
        padding: 0 !important; 
        opacity: 1 !important;
        text-transform: none !important;
    }

    /* Mobile Drawer Langs Fix */
    .drawer-langs { 
        margin-top: 50px; 
        padding-top: 30px; 
        border-top: 1px solid rgba(255,255,255,0.06); 
        display: flex; gap: 15px; 
    }
    .drawer-langs ul { display: flex; gap: 20px; list-style: none; padding: 0; }
}

@media (max-width: 768px) {
    body .top-bar-contacts { display: none !important; } 
    body .top-bar-logo { max-width: 130px !important; }
    body .hero-title { font-size: 32px !important; }
    body .dynamic-logo-container { max-width: 280px !important; }
    body .hero-subtitle { font-size: 16px !important; }
}


/* ══════════════════════════════════
   MASTER 2030 FRONT-PAGE
   ══════════════════════════════════ */
.master-hero {
    min-height: 85vh; display: flex; align-items: center; position: relative;
    background: var(--white); padding: 60px 0;
}
.hero-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 40px;
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px; align-items: center;
}
.hero-title { font-size: 48px; font-weight: 300; line-height: 1.1; margin-bottom: 25px; color: var(--tech-dark); }
.hero-subtitle { font-size: 18px; color: var(--text-dim); margin-bottom: 35px; max-width: 500px; }
.hero-highlight-box { padding: 25px 30px; background: var(--tech-gray); border-left: 5px solid var(--brand-blue); margin-bottom: 30px; font-size: 17px; }

.section-sober { padding: 120px 40px; }
.section-container { max-width: 1000px; margin: 0 auto; }
.section-container.narrow { max-width: 700px; }
.section-title { font-size: 36px; margin-bottom: 60px; text-align: center; color: var(--tech-dark); }

.bg-gray { background: var(--tech-gray); }
.bg-navy { background: var(--tech-navy); color: var(--white) !important; }
.bg-navy .section-title, .bg-navy h2, .bg-navy h3 { color: var(--white) !important; }
.bg-navy p, .bg-navy li { color: rgba(255,255,255,0.85); }

.text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; }
.steps-linear { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.step-item { border-top: 1px solid rgba(0,0,0,0.1); padding-top: 25px; }
.step-label { color: var(--brand-blue); font-size: 11px; font-weight: 700; margin-bottom: 10px; display: block; }

.responsibility-table { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(255,255,255,0.1); }
.resp-col { padding: 60px 40px; }
.resp-col.highlight { background: rgba(255,255,255,0.03); }
.resp-list li { margin-bottom: 12px; font-size: 15px; opacity: 0.9; }

.package-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.package-card { padding: 50px 40px; border: 1px solid rgba(0,0,0,0.08); background: var(--white); text-align: center; }
.package-card.featured { border-top: 6px solid var(--brand-blue); box-shadow: 0 15px 40px rgba(0,0,0,0.04); }

/* ══════════════════════════════════
   MASTER 2030 FOOTER
   ══════════════════════════════════ */
.master-footer { 
    background: var(--tech-navy); 
    color: var(--white); 
    padding: 100px 40px 60px; 
    border-top: 1px solid rgba(255,255,255,0.05); 
    position: relative;
    z-index: 10;
}
.footer-grid { 
    max-width: 1200px; 
    margin: 0 auto; 
}
.footer-top-row {
    display: grid; 
    grid-template-columns: 1.2fr 1fr 1fr; 
    gap: 60px;
    margin-bottom: 60px;
}
.footer-bottom-fullwidth {
    width: 100%;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.footer-col.full-width {
    width: 100%;
}
.footer-col-widget { margin-bottom: 40px; }
.footer-col-widget h4 { 
    margin-bottom: 25px; color: var(--white); font-size: 16px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
}
.footer-col-widget ul { list-style: none; padding: 0; }
.footer-col-widget li { margin-bottom: 12px; font-size: 14px; opacity: 0.8; }
.footer-col-widget a { color: var(--white); text-decoration: none; transition: all 0.3s var(--ease); }
.footer-col-widget a:hover { opacity: 1; color: var(--brand-blue); padding-left: 5px; }

.footer-bottom-wide { 
    margin-top: 60px; 
    padding-top: 40px; 
    border-top: 1px solid rgba(255,255,255,0.05); 
    max-width: 1200px; 
    margin-left: auto; 
    margin-right: auto;
}
.footer-bottom-wide-widget { text-align: center; }
.footer-wide-title { 
    color: var(--white); font-size: 16px; margin-bottom: 25px; 
    text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}

.footer-bottom { 
    margin-top: 80px; padding-top: 30px; 
    border-top: 1px solid rgba(255,255,255,0.05); 
    text-align: center; font-size: 12px; opacity: 0.4; color: var(--white); 
}

.sidebar-extra { padding: 30px 20px; border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar-extra-widget { margin-bottom: 30px; }
.sidebar-extra-widget h5 { color: var(--white); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; opacity: 0.5; }
.sidebar-extra-widget p { font-size: 12px; color: rgba(255,255,255,0.7); line-height: 1.6; }

@media (max-width: 991px) {
    .footer-top-row { grid-template-columns: 1fr; gap: 40px; }
    .master-footer { padding: 60px 20px; }
}

/* UTILS */
.btn-primary {
    display: inline-block; padding: 16px 36px; background: var(--brand-blue); color: var(--white);
    font-weight: 700; border-radius: 4px; border: none; cursor: pointer; transition: 0.3s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-3px); }

.hero-visual-side {
    position: relative;
    display: flex; justify-content: center; align-items: center;
}
.dynamic-logo-container {
    width: 100%; max-width: 460px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

/* Immagine logo reale */
.hero-logo-img {
    width: 100%; height: auto;
    display: block;
    animation: logoPulse 4s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(61, 122, 191, 0.08));
}
@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(61, 122, 191, 0.05)); }
    50%       { filter: drop-shadow(0 0 28px rgba(61, 122, 191, 0.22)) drop-shadow(0 0 12px rgba(243, 146, 0, 0.12)); }
}

/* SVG scintille in overlay sopra il logo */
.hero-spark-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 6;
    overflow: visible;
}

/* ══════════════════════════════════
   ARCHIVIO CATEGORIA / NEWS
   ══════════════════════════════════ */

.archive-header {
    padding-top: 80px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.archive-description {
    color: var(--text-dim);
    margin-top: 12px;
    font-size: 17px;
    max-width: 640px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 12px;
}

.post-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
}

.post-card-thumb {
    display: block;
    overflow: hidden;
    height: 200px;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s var(--ease);
}

.post-card:hover .post-card-thumb img {
    transform: scale(1.04);
}

.post-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 10px;
}

.post-cat a {
    color: var(--brand-blue);
    font-weight: 600;
}

.post-card-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
    margin-bottom: 12px;
}

.post-card-title a {
    color: inherit;
    text-decoration: none;
}

.post-card-title a:hover { color: var(--brand-blue); }

.post-card-excerpt {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 18px;
}

.post-card-link {
    color: var(--brand-blue);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    align-self: flex-start;
}

.post-card-link:hover { color: var(--tech-dark); }

/* Paginazione */
.archive-pagination {
    margin-top: 48px;
    text-align: center;
}

.archive-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.archive-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--tech-gray);
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background .2s, color .2s;
}

.archive-pagination .page-numbers.current,
.archive-pagination .page-numbers:hover {
    background: var(--brand-blue);
    color: #fff;
}

/* Nessun post */
.no-posts-found {
    text-align: center;
    padding: 80px 20px;
}

.no-posts-found h2 {
    font-size: 28px;
    color: var(--text-main);
    margin-bottom: 16px;
}

.no-posts-found p {
    color: var(--text-dim);
    margin-bottom: 32px;
}

/* ══════════════════════════════════
   SINGLE POST
   ══════════════════════════════════ */

.single-post-wrapper {
    max-width: 800px;
    margin: 80px auto;
    padding: 0 24px;
}

.single-post-header { margin-bottom: 32px; }

.single-post-meta {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.single-post-title {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
}

.single-post-thumb {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 40px;
}

.single-post-thumb img { width: 100%; height: auto; }

.single-post-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-main);
}

.single-post-content h2 { font-size: 26px; margin: 40px 0 16px; }
.single-post-content h3 { font-size: 21px; margin: 32px 0 12px; }
.single-post-content p  { margin-bottom: 20px; }
.single-post-content ul, .single-post-content ol { padding-left: 24px; margin-bottom: 20px; }
.single-post-content li { margin-bottom: 8px; }
.single-post-content a  { color: var(--brand-blue); }

/* Responsive */
@media (max-width: 768px) {
    .hero-inner, .text-grid, .steps-linear, .responsibility-table, .package-grid, .footer-grid { grid-template-columns: 1fr; }
    .hero-title { font-size: 34px; }
    .dynamic-logo-container { max-width: 250px; margin-top: 40px; }
    .posts-grid { grid-template-columns: 1fr; }
    .single-post-title { font-size: 26px; }
}
