/* ============================================================
   JASCO TECH — MODERN FLOATING PILL NAVBAR
   Premium glassmorphic navbar that shrinks and floats on scroll
   ============================================================ */

:root {
  --nav-height: 88px;
  --nav-height-scrolled: 64px;
}

/* ---- NAVBAR BASE ---- */
#mainNav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-nav);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: transparent;
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: var(--space-2) 0;
}

/* Scrolled state — triggers floating pill */
#mainNav.scrolled {
  height: var(--nav-height-scrolled);
  padding-top: var(--space-4);
}

.nav-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-gutter);
  height: 100%;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  border-radius: 0;
}

#mainNav.scrolled .nav-container {
  max-width: calc(var(--container-max) - 48px);
  background-color: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-pill);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06), 0 1px 0 0 rgba(0, 0, 0, 0.04);
  padding: 0 var(--space-8);
  height: 56px;
}

/* ---- LOGO ---- */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 34px;
  width: auto;
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease;
}

.nav-logo .logo-color {
  display: none;
}

.nav-logo .logo-white {
  display: block;
}

#mainNav.scrolled .nav-logo img {
  height: 28px;
}

#mainNav.scrolled .nav-logo .logo-color {
  display: block;
}

#mainNav.scrolled .nav-logo .logo-white {
  display: none;
}

.nav-logo:hover img {
  opacity: 0.85;
}

/* ---- NAV MENU ---- */
.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nav Item */
.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: color 0.3s ease;
  white-space: nowrap;
  position: relative;
}

#mainNav.scrolled .nav-link {
  color: var(--color-text-secondary);
}

/* Premium underline reveal on active/hover */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 16px;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-pill);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
}

.nav-link:hover {
  color: #FFFFFF;
}

#mainNav.scrolled .nav-link:hover {
  color: var(--color-text-primary);
}

.nav-link.active {
  color: var(--color-blue);
}

.nav-link.active::after,
.nav-link:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* Dropdown arrow */
.nav-link .nav-arrow {
  font-size: 0.65rem;
  transition: transform 0.25s ease;
  opacity: 0.8;
}

#mainNav.scrolled .nav-link .nav-arrow {
  opacity: 0.5;
}

.nav-item:hover .nav-arrow,
.nav-item.open .nav-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

/* ---- DROPDOWN MENU ---- */
.dropdown-menu-custom {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.98);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  min-width: 270px;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform-origin: top center;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.08);
  z-index: var(--z-nav);
}

.nav-item:hover .dropdown-menu-custom,
.nav-item.open .dropdown-menu-custom {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

.dropdown-menu-custom::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--gradient-brand);
  opacity: 0.5;
}

.dropdown-item-custom {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.dropdown-item-custom:hover {
  background: rgba(17, 179, 224, 0.05);
  color: var(--color-blue);
  transform: translateX(4px);
}

.dropdown-item-custom i {
  font-size: 0.95rem;
  opacity: 0.5;
  flex-shrink: 0;
  transition: color 0.2s;
}

.dropdown-item-custom:hover i {
  opacity: 1;
  color: var(--color-blue);
}

/* ---- MEGA DROPDOWN (Categorized Solutions) ---- */
.dropdown-menu-custom.dropdown-menu-mega {
  min-width: 720px;
  max-width: calc(100vw - 32px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  padding: var(--space-5);
}

.dropdown-category {
  display: flex;
  flex-direction: column;
}

.dropdown-category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-blue);
  padding: 6px 8px 8px;
  border-bottom: 1px solid rgba(17, 179, 224, 0.2);
  margin-bottom: 6px;
}

.dropdown-category-title i {
  font-size: 0.85rem;
  color: var(--color-teal);
}

.dropdown-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dropdown-sublist .dropdown-item-custom {
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.35;
}

/* ---- NAV ACTIONS ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.nav-phone {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.85rem;
  font-weight: var(--fw-medium);
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: color 0.2s ease;
}

#mainNav.scrolled .nav-phone {
  color: var(--color-text-secondary);
}

.nav-phone:hover {
  color: var(--color-blue);
}

.nav-phone i {
  font-size: 0.95rem;
}

/* CTA Button in nav */
.nav-cta {
  padding: 8px 20px;
  font-size: 0.8rem;
  font-weight: var(--fw-bold);
  height: 38px;
}

#mainNav.scrolled .nav-cta {
  height: 34px;
  padding: 6px 18px;
}

/* ---- HAMBURGER BUTTON ---- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-circle);
  padding: 0 10px;
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

#mainNav.scrolled .hamburger {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.hamburger:hover {
  background: rgba(17, 179, 224, 0.05);
  border-color: rgba(17, 179, 224, 0.2);
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: #FFFFFF;
  border-radius: var(--radius-pill);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              width 0.3s ease;
  transform-origin: center;
}

#mainNav.scrolled .hamburger-line {
  background: var(--color-text-primary);
}

/* Hamburger open state — X morph */
.hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- MOBILE MENU ---- */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 100px var(--container-gutter) var(--space-10);
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mobile-menu.open {
  transform: translateY(0);
}

body.menu-open .nav-container {
  background: var(--gradient-brand-90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-nav-link:hover {
  color: var(--color-blue);
}

.mobile-dropdown {
  list-style: none;
  padding: 0 0 var(--space-4) var(--space-4);
  margin: 0;
  display: none;
}

.mobile-dropdown.open {
  display: block;
}

.mobile-dropdown-item {
  display: block;
  padding: 10px 0;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mobile-dropdown-item:hover {
  color: var(--color-blue);
}

/* Mobile categorized dropdown */
.mobile-dropdown-category {
  margin-bottom: var(--space-3);
}

.mobile-dropdown-category:last-child {
  margin-bottom: 0;
}

.mobile-dropdown-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-blue);
  padding: 10px 0 4px;
}

.mobile-dropdown-category-title i {
  font-size: 0.85rem;
  color: var(--color-teal);
}

.mobile-dropdown-sublist {
  list-style: none;
  padding: 0 0 0 var(--space-3);
  margin: 0;
}

.mobile-dropdown-sublist .mobile-dropdown-item {
  padding: 6px 0;
  font-size: 0.9rem;
}

.mobile-actions {
  margin-top: var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mobile-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 0.95rem;
}

/* Body scroll lock when mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* Responsive adjustments for the floating navbar */
@media (max-width: 1024px) {
  #mainNav.scrolled .nav-container {
    max-width: calc(100% - 32px);
    padding: 0 var(--space-5);
  }
}
