/* ===== NAVBAR BASE ===== */
.ssfc-nav-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-light);
}

.ssfc-nav-container {
  position: relative; /* FIX 1: needed for absolute mobile nav */
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 16px;
}

/* LOGO */
.logo a {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

/* ===== NAV LIST ===== */
.ssfc-nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ssfc-nav-list > li {
  position: relative;
}

/* LINKS + MEGA BUTTON */
.ssfc-nav-list > li > a,
.ssfc-mega-toggle {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
  transition:
    color 0.2s,
    background 0.2s;
  white-space: nowrap;
}

.ssfc-nav-list > li > a:hover,
.ssfc-mega-toggle:hover {
  color: var(--primary);
  background: rgba(59, 158, 255, 0.08);
}

/* CHEVRON — FIX 2: rotates on open */
.ssfc-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.ssfc-nav-item-hasmega.open .ssfc-chevron,
.ssfc-nav-item-hasmega:hover .ssfc-chevron {
  transform: rotate(180deg);
}

/* ===== MEGA MENU ===== */
.ssfc-nav-item-hasmega {
  position: relative;
}

.ssfc-mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: clamp(220px, 360px, 92vw); /* FIX 3: safe width */
  background: rgb(0 0 0 / 85%);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

/* Desktop hover */
@media (min-width: 769px) {
  .ssfc-nav-item-hasmega:hover .ssfc-mega-menu,
  .ssfc-nav-item-hasmega:focus-within .ssfc-mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
}

/* JS-driven open class (desktop fallback + mobile) */
.ssfc-nav-item-hasmega.open .ssfc-mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* MEGA GRID */
.ssfc-mega-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.ssfc-mega-col a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  /* color: var(--text-muted); */
  font-size: 0.88rem;
  font-weight: 500;
  transition:
    color 0.18s,
    background 0.18s;
}
.ssfc-mega-col a:hover {
  color: var(--primary);
  background: rgba(59, 158, 255, 0.08);
}

/* ===== CTA ===== */
.nav-right {
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* ===== MOBILE TOGGLE ===== */
.ssfc-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ssfc-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .ssfc-nav-toggle {
    display: flex;
    align-items: center;
  }

  .ssfc-nav {
    /* FIX 4: attach to container, not header */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgb(0 0 0 / 85%);
    border-top: 1px solid var(--border-light);

    /* Animate with max-height instead of display:none — FIX 5 */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .ssfc-nav.active {
    max-height: 600px;
  }

  .ssfc-nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    gap: 2px;
  }
  .ssfc-nav-container {
    gap: 4px;
  }
  .ssfc-nav-list > li > a,
  .ssfc-mega-toggle {
    width: 100%;
    /* justify-content: space-between; */
  }

  /* MEGA MOBILE — FIX 6: no position conflict */
  .ssfc-mega-menu {
    position: static;
    transform: none !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-radius: 10px;
    padding: 8px 8px;
    margin-top: 4px;

    /* collapsed by default */
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transition: max-height 0.28s ease;
  }

  .ssfc-nav-item-hasmega.open .ssfc-mega-menu {
    max-height: 400px;
    padding: 8px;
  }
}
@media (max-width: 360px) {
  .nav-right {
    display: none;
  }

}
