/* ===== SHARED MOBILE MENU — Include this on ALL pages =====
   Single source of truth for mobile header + menu styling.
   Edit THIS file and all pages update automatically.
   ===================================================== */

/* ============================================
   MOBILE HEADER — top bar
   ============================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 14px;
}

.mobile-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 0;
  box-shadow: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-header.menu-open .mobile-header-inner {
  /* Already transparent by default */
}

.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 500;
  color: #0f172a;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s ease, color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo hidden on scroll down */
.mobile-header.scroll-down .mobile-header-logo {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.mobile-header.menu-open .mobile-header-logo {
  opacity: 0;
  pointer-events: none;
}

.mobile-logo-img {
  height: 32px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

.mobile-header-logo svg {
  width: 28px;
  height: 28px;
}

/* ============================================
   HAMBURGER BUTTON
   ============================================ */
.menu-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1730bc;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1001;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.menu-toggle:hover {
  transform: scale(1.05);
}

.menu-toggle-bar {
  position: absolute;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle-bar:nth-child(1) {
  transform: translateY(-5px);
}

.menu-toggle-bar:nth-child(2) {
  transform: translateY(0);
}

.menu-toggle-bar:nth-child(3) {
  transform: translateY(5px);
}

.menu-open .menu-toggle-bar:nth-child(1) {
  transform: translateY(0) rotate(45deg);
}

.menu-open .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.menu-open .menu-toggle-bar:nth-child(3) {
  transform: translateY(0) rotate(-45deg);
}

/* ============================================
   MOBILE MENU — Floating card
   ============================================ */
.mobile-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 998;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu {
  position: fixed;
  top: 72px;
  left: 16px;
  right: 16px;
  bottom: auto;
  z-index: 999;
  background: #091427;
  border-radius: 28px;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-16px) scale(0.97);
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 25px 80px -15px rgba(0, 0, 0, 0.6),
              0 10px 30px -5px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Decorative blue blob */
.mobile-menu::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(23, 48, 188, 0.5) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

/* Decorative orange blob */
.mobile-menu::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -30px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.35) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ============================================
   MOBILE MENU — Links & Navigation
   ============================================ */
.mobile-menu a {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  padding: 12px 8px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu a:active {
  color: #fff;
  opacity: 0.7;
}

.mobile-menu.is-open a {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.mobile-menu.is-open .main-panel > .has-sub:nth-child(1) { transition-delay: 0.08s; }
.mobile-menu.is-open .main-panel > .has-sub:nth-child(2) { transition-delay: 0.13s; }
.mobile-menu.is-open .main-panel > a:nth-of-type(1) { transition-delay: 0.18s; }
.mobile-menu.is-open .main-panel > a:nth-of-type(2) { transition-delay: 0.23s; }
.mobile-menu.is-open .main-panel > a:nth-of-type(3) { transition-delay: 0.28s; }

/* ============================================
   MOBILE MENU — Divider
   ============================================ */
.mobile-menu-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 8px 0 12px;
  position: relative;
  z-index: 1;
}

/* ============================================
   MOBILE MENU — CTA Button
   ============================================ */
.mobile-menu .btn-menu-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #091427;
  padding: 12px 16px 12px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px;
  border: none;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mobile-menu.is-open .btn-menu-cta {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

.mobile-menu .btn-menu-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.mobile-menu .btn-menu-cta .btn-icon {
  width: 26px;
  height: 26px;
  background: #1730bc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-menu .btn-menu-cta .btn-icon svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
}

/* ============================================
   MOBILE MENU — Sub-panels (sliding)
   ============================================ */
.menu-panels {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-panels.show-prodotti {
  transform: translateX(-33.33%);
}

.menu-panels.show-servizi {
  transform: translateX(-66.66%);
}

.menu-panel {
  width: 33.33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 28px 32px;
  gap: 2px;
  overflow-y: auto;
}

/* ============================================
   MOBILE MENU — Sub-menu buttons
   ============================================ */
.mobile-menu .has-sub {
  font-size: 22px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  padding: 12px 8px;
  border-radius: 12px;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu.is-open .has-sub {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu .has-sub svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  opacity: 0.5;
}

/* ============================================
   MOBILE MENU — Back button
   ============================================ */
.mobile-menu .back-btn {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  padding: 10px 8px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.mobile-menu .back-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.mobile-menu .back-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.mobile-menu .sub-panel a {
  font-size: 20px;
}

/* ============================================
   RESPONSIVE — Show mobile header on mobile
   ============================================ */
@media (max-width: 768px) {
  .mobile-header { display: block; }

  /* Hamburger: glass background */
  .menu-toggle {
    background: rgba(255, 255, 255, 0.10) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
  }

  /* Menu: light gradient with colored blobs */
  .mobile-menu {
    background:
      radial-gradient(ellipse 70% 55% at 90% 10%, rgba(59, 130, 246, 0.30) 0%, transparent 60%),
      radial-gradient(ellipse 60% 50% at 10% 85%, rgba(249, 115, 22, 0.22) 0%, transparent 55%),
      radial-gradient(ellipse 50% 45% at 50% 50%, rgba(23, 48, 188, 0.10) 0%, transparent 50%),
      linear-gradient(170deg, #dfe6f2 0%, #c8d4e8 30%, #b8c8e0 55%, #d0daea 80%, #dfe6f2 100%) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 80px -15px rgba(0, 0, 0, 0.35),
                0 10px 30px -5px rgba(0, 0, 0, 0.2) !important;
  }
  .mobile-menu::before {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.35) 0%, transparent 70%) !important;
    width: 260px !important;
    height: 260px !important;
  }
  .mobile-menu::after {
    background: radial-gradient(circle, rgba(249, 115, 22, 0.25) 0%, transparent 70%) !important;
    width: 220px !important;
    height: 220px !important;
  }

  /* Text colors: dark on light background */
  .mobile-menu a { color: #0f172a !important; }
  .mobile-menu a:active { color: #1730bc !important; opacity: 0.7; }
  .mobile-menu .has-sub { color: #0f172a !important; }
  .mobile-menu .has-sub:active { color: #1730bc !important; opacity: 0.7; }
  .mobile-menu .has-sub svg { stroke: currentColor; opacity: 0.4; }
  .mobile-menu .back-btn { color: #475569 !important; }
  .mobile-menu .back-btn:active { color: #0f172a !important; }
  .mobile-menu .back-btn svg { stroke: currentColor; }
  .mobile-menu-divider { background: rgba(23, 48, 188, 0.12) !important; }

  /* CTA container */
  .mobile-menu-ctas {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    position: relative;
    z-index: 1;
  }

  /* Shared CTA base */
  .mobile-menu .btn-menu-cta,
  .mobile-menu .btn-menu-secondary {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    width: auto !important;
    padding: 11px 11px 11px 22px !important;
    border-radius: 100px;
    font-size: 14px !important;
    font-weight: 600;
    position: relative;
    z-index: 1;
    margin-top: 0 !important;
    border: none;
    align-self: center;
  }

  /* Primary CTA: blue gradient */
  .mobile-menu .btn-menu-cta {
    background: linear-gradient(135deg, #1730bc 0%, #0d1552 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(23, 48, 188, 0.35) !important;
  }
  .mobile-menu .btn-menu-cta .btn-icon {
    background: #fff !important;
  }
  .mobile-menu .btn-menu-cta .btn-icon svg {
    stroke: #1730bc !important;
  }

  /* Secondary CTA: frosted, orange icon */
  .mobile-menu .btn-menu-secondary {
    background: rgba(255, 255, 255, 0.55) !important;
    color: #0f172a !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(23, 48, 188, 0.12) !important;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mobile-menu.is-open .btn-menu-secondary {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.35s;
  }
  .mobile-menu .btn-menu-secondary .btn-icon {
    width: 26px;
    height: 26px;
    background: #f97316;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .mobile-menu .btn-menu-secondary .btn-icon svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
  }
  .mobile-menu .btn-menu-secondary:hover {
    background: rgba(255, 255, 255, 0.75) !important;
  }

  /* Backdrop blur */
  .mobile-menu-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .mobile-menu-backdrop.is-open {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.15) !important;
  }

  /* Email contact */
  .mobile-menu .menu-email {
    display: block;
    text-align: center;
    font-size: 13px;
    color: #475569 !important;
    font-weight: 400;
    padding: 8px 0 0;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mobile-menu.is-open .menu-email {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
  }
}
