/* Products menu: category -> product submenus */
html,
body {
  overflow-x: hidden !important;
}

.dropdown.products-dropdown-extended {
  overflow: visible !important;
}

.products-submenu-item {
  position: relative;
}

.menu-popup-link.has-submenu {
  position: relative;
  padding-right: 2rem !important;
  touch-action: manipulation;
}

.menu-popup-link.has-submenu::after {
  content: '\203A';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
}

.products-submenu {
  position: absolute;
  top: -0.25rem;
  left: calc(100% - 0.45rem);
  width: min(410px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  border-radius: 16px;
  border: 1px solid #d3deea;
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(245,249,253,0.98));
  box-shadow: 0 22px 48px rgba(15,23,42,0.17), 0 2px 0 rgba(255,255,255,0.75) inset;
  backdrop-filter: blur(5px);
  padding: 0.65rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) translateX(4px);
  pointer-events: none;
  overflow-x: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  z-index: 999;
}

.products-submenu-item:hover > .products-submenu,
.products-submenu-item:focus-within > .products-submenu,
.menu-popup-link.has-submenu.submenu-open + .products-submenu,
.products-submenu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) translateX(0);
  pointer-events: auto;
}

.products-submenu-item:hover > .menu-popup-link.has-submenu::after,
.products-submenu-item:focus-within > .menu-popup-link.has-submenu::after,
.menu-popup-link.has-submenu.submenu-open::after {
  transform: translateY(-50%) rotate(90deg);
  color: #2f6f2b;
}

.products-submenu-scroll {
  max-height: 370px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
}

.products-submenu-scroll::-webkit-scrollbar {
  width: 7px;
}

.products-submenu-scroll::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.45);
  border-radius: 999px;
}

.products-submenu-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown.products-dropdown-extended .products-submenu .products-submenu-link {
  display: inline-flex !important;
  width: 100%;
  align-items: center !important;
  gap: 0.62rem !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  color: #1f2937;
  text-decoration: none;
  border-radius: 11px;
  padding: 0.56rem 0.66rem;
  font-size: 0.82rem;
  line-height: 1.25;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.dropdown.products-dropdown-extended .products-submenu .products-submenu-marker {
  width: 0.8rem;
  height: 0.8rem;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  margin-top: 0;
  line-height: 1 !important;
}

.products-submenu-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 999px;
  display: block;
  background: linear-gradient(135deg, #5aba4a, #3d9b35);
  box-shadow: 0 0 0 3px rgba(90, 186, 74, 0.12);
}

.dropdown.products-dropdown-extended .products-submenu .products-submenu-text {
  display: inline-block !important;
  flex: 1 1 auto;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  min-width: 0 !important;
  color: #1f2937;
}

.products-submenu-link:hover {
  background: linear-gradient(135deg, rgba(90,186,74,0.13), rgba(186,230,253,0.19));
  border-color: rgba(90,186,74,0.18);
  color: #0f172a;
  transform: translateX(1px);
}

.products-submenu-link:hover .products-submenu-text {
  color: #0f172a;
}

@media (max-width: 1024px) {
  .products-submenu {
    position: static;
    width: 100%;
    margin: 0.35rem 0 0.25rem;
    box-shadow: 0 10px 24px rgba(15,23,42,0.1);
    border-radius: 10px;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    display: none;
  }

  .products-submenu-item {
    touch-action: manipulation;
  }

  .menu-popup-link.has-submenu::after {
    right: 0.5rem;
  }

  .products-submenu.open,
  .menu-popup-link.has-submenu.submenu-open + .products-submenu {
    display: block;
  }
}

/* Global logo size override (header + footer) */
.logo-header .logo-image {
  height: 56px !important;
  width: auto !important;
}

.logo-footer .logo-image {
  display: block !important;
  height: 54px !important;
  width: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
}

footer .logo-footer {
  display: inline-flex !important;
  align-items: center !important;
  max-width: 100% !important;
}

@media (max-width: 768px) {
  .logo-header .logo-image {
    height: 50px !important;
  }

  .logo-footer .logo-image {
    height: 46px !important;
    max-width: 100% !important;
  }
}

/* Unified Footer Redesign */
footer {
  margin-top: 2.2rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(1200px 420px at -8% -10%, rgba(90, 186, 74, 0.22), transparent 60%),
    radial-gradient(980px 360px at 108% -15%, rgba(59, 130, 246, 0.16), transparent 62%),
    linear-gradient(145deg, #101d30 0%, #0a1525 58%, #081120 100%) !important;
  color: #dbe6f3;
  padding: 2.1rem 1.2rem 1.1rem;
}

footer .footer-top {
  max-width: 1220px;
  margin: 0 auto;
  display: grid !important;
  grid-template-columns: minmax(290px, 1.35fr) repeat(4, minmax(170px, 1fr));
  gap: 1.2rem 1.3rem;
  align-items: start;
}

footer .footer-brand {
  padding: 0.95rem 1.05rem;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 18px 34px rgba(2, 6, 23, 0.34);
}

footer .footer-brand p {
  color: #c8d5e5 !important;
  line-height: 1.6;
  font-size: 0.88rem;
  margin-top: 0.75rem;
}

footer .footer-contact-line,
footer .footer-location-line {
  margin-top: 0.5rem !important;
  font-size: 0.84rem !important;
}

footer .footer-brand a {
  color: #f0f7ff !important;
  text-decoration: none;
}

footer .footer-col h4 {
  color: #ffffff !important;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
}

footer .footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

footer .footer-col li {
  margin-bottom: 0.5rem !important;
}

footer .footer-col a,
footer .footer-bottom-links a,
footer .footer-bottom p {
  color: #d4deec !important;
  text-decoration: none;
  font-size: 0.84rem !important;
  line-height: 1.4;
  opacity: 0.95;
}

footer .footer-col a:hover,
footer .footer-bottom-links a:hover {
  color: #a1f992 !important;
  opacity: 1;
}

footer .footer-bottom {
  max-width: 1220px;
  margin: 1.25rem auto 0;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

footer .footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 1.05rem !important;
}

@media (max-width: 1120px) {
  footer .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  footer {
    padding: 1.7rem 0.9rem 1rem;
  }

  footer .footer-top {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  footer .footer-brand {
    padding: 0.9rem;
  }
}

/* Mobile Header Menu Redesign */
@media (max-width: 1024px) {
  body.mobile-menu-open {
    overflow: hidden !important;
  }

  #mainNav {
    position: sticky;
    top: 0;
    z-index: 1200;
  }

  .nav-hamburger {
    display: inline-flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: 1px solid #d6e0ea;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    z-index: 1301;
  }

  .nav-hamburger span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #0f1d2f;
    transition: transform 0.24s ease, opacity 0.24s ease;
  }

  .nav-hamburger.nav-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-hamburger.nav-open span:nth-child(2) {
    opacity: 0;
  }

  .nav-hamburger.nav-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-links {
    position: fixed !important;
    top: 76px !important;
    right: 0 !important;
    width: min(90vw, 380px) !important;
    max-width: 380px !important;
    height: calc(100dvh - 76px) !important;
    margin: 0 !important;
    padding: 1rem 0.8rem 1.4rem !important;
    list-style: none;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%) !important;
    border-left: 1px solid #d9e2ec;
    box-shadow: -24px 0 50px rgba(15, 23, 42, 0.18);
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(105%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
    display: block !important;
    z-index: 1300;
  }

  .nav-links.nav-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-links .nav-item {
    margin: 0.1rem 0;
    width: 100%;
  }

  .nav-links .nav-item > a,
  .nav-links .nav-item > span {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 0.58rem 0.72rem !important;
    border-radius: 11px;
    color: #0f172a !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    background: transparent;
  }

  .nav-links .nav-item.mobile-open > span,
  .nav-links .nav-item > a:hover,
  .nav-links .nav-item > span:hover {
    background: rgba(15, 23, 42, 0.06);
  }

  .nav-links .nav-item > span svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
  }

  .nav-links .nav-item.mobile-open > span svg {
    transform: rotate(180deg);
  }

  .nav-links .dropdown {
    position: static !important;
    display: none !important;
    min-width: 0 !important;
    width: 100% !important;
    margin: 0.2rem 0 0.35rem !important;
    padding: 0.35rem !important;
    border-radius: 12px !important;
    border: 1px solid #dbe5ef !important;
    background: #f8fbff !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    z-index: auto !important;
  }

  .nav-links .nav-item.mobile-open > .dropdown {
    display: block !important;
  }

  .nav-links .dropdown .menu-popup-link {
    margin: 0.12rem 0 !important;
    padding: 0.54rem 0.56rem !important;
    border-radius: 9px !important;
  }

  .nav-cta {
    display: none !important;
  }

  .nav-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease;
    z-index: 1250;
  }

  .nav-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
  }
}

/* Start Your Project as a menu item (mobile drawer) */
.nav-item.nav-start-project {
  display: none;
}

@media (max-width: 1024px) {
  .nav-item.nav-start-project {
    display: block;
    margin-top: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px solid #dbe5ef;
  }

  .nav-item.nav-start-project > a {
    background: linear-gradient(135deg, #111c2c, #0a1525) !important;
    color: #f8fafc !important;
    font-weight: 700 !important;
  }
}

/* Mobile Menu Full-Width Premium Upgrade */
@media (max-width: 1024px) {
  .nav-links {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    top: 72px !important;
    height: calc(100dvh - 72px) !important;
    border-left: 0 !important;
    box-shadow: 0 -1px 0 #dbe5ef, 0 24px 60px rgba(15, 23, 42, 0.2) !important;
    background:
      radial-gradient(900px 260px at -10% -10%, rgba(90, 186, 74, 0.12), transparent 55%),
      radial-gradient(700px 260px at 110% -20%, rgba(59, 130, 246, 0.1), transparent 55%),
      linear-gradient(180deg, #ffffff 0%, #f4f8fc 100%) !important;
    padding: 0.9rem 0.9rem 1.35rem !important;
  }

  .nav-links::before {
    content: "Menu";
    display: block;
    color: #5f6f82;
    font-size: 0.74rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    font-weight: 700;
    margin: 0.1rem 0.25rem 0.55rem;
  }

  .nav-links .nav-item {
    margin: 0.16rem 0;
  }

  .nav-links .nav-item > a,
  .nav-links .nav-item > span {
    min-height: 48px;
    padding: 0.7rem 0.82rem !important;
    border-radius: 14px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    font-size: 0.98rem !important;
  }

  .nav-links .nav-item.mobile-open > span,
  .nav-links .nav-item > a:hover,
  .nav-links .nav-item > span:hover {
    border-color: #cfdae6;
    background: #ffffff;
  }

  .nav-links .dropdown {
    margin: 0.3rem 0 0.5rem !important;
    padding: 0.4rem !important;
    border-radius: 14px !important;
    border: 1px solid #d5e0eb !important;
    background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .nav-links .dropdown .menu-popup-link {
    border-radius: 10px !important;
    padding: 0.6rem 0.62rem !important;
  }

  .nav-links .dropdown .menu-popup-link .menu-popup-text {
    font-size: 0.88rem;
  }

  .nav-item.nav-start-project {
    margin-top: 0.5rem;
    padding-top: 0.55rem;
  }

  .nav-item.nav-start-project > a {
    justify-content: center !important;
    min-height: 50px;
    border: 0 !important;
    box-shadow: 0 14px 28px rgba(16, 29, 48, 0.22) !important;
    background: linear-gradient(135deg, #111c2c, #0a1525) !important;
    color: #f8fafc !important;
  }

  .nav-mobile-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
  }
}

/* Mobile menu interaction + spacing hotfix */
@media (max-width: 1024px) {
  #mainNav {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    width: 100%;
  }

  .nav-links {
    top: 74px !important;
    height: calc(100dvh - 74px) !important;
  }

  .hero {
    margin-top: 0 !important;
  }

  .products-submenu {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .nav-mobile-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

}

/* Remove dark backdrop overlay behind mobile menu */
@media (max-width: 1024px) {
  .nav-mobile-overlay {
    display: none !important;
    background: transparent !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}
