/* ============================================
   SmartB Academy - Navigation (v2 Fresh)
   Mobile-first: hamburger default, desktop at 768px
   ============================================ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.scrolled {
  background: var(--white);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 768px) { .nav-inner { padding: 0 32px; } }

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-logo img { height: 24px; width: auto; }
.nav-logo-text { font-size: 18px; font-weight: 700; color: var(--text); }

/* Desktop links - hidden mobile */
.nav-links { display: none; align-items: center; gap: 32px; }
.nav-links > a,
.nav-links > .nav-dropdown > .nav-dropdown-trigger {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
  padding: 4px 0;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.nav-links > a:hover,
.nav-links > .nav-dropdown:hover > .nav-dropdown-trigger,
.nav-links > a[aria-current="page"],
.nav-dropdown-trigger[aria-current="page"] { color: var(--text); }
.nav-links > a[aria-current="page"]::after,
.nav-dropdown-trigger[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--grad);
  border-radius: 1px;
}

/* Dropdown chevron */
.nav-dropdown-trigger .chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 4px;
  vertical-align: middle;
  transition: transform 0.25s ease;
}
.nav-dropdown.open .nav-dropdown-trigger .chevron {
  transform: rotate(180deg);
}

/* ---- Mega dropdown ---- */
.nav-dropdown {
  position: static;
}

/* Two-column mega dropdown */
.nav-mega {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 620px;
  background: var(--pure-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 100;
  display: grid;
  grid-template-columns: 190px 1fr;
  margin-top: 8px;
  overflow: hidden;
}

.nav-dropdown.open .nav-mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Left column - category tabs */
.nav-mega-left {
  width: 190px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
}
.nav-mega-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}
.nav-mega-tab svg {
  display: inline-block;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.nav-mega-tab:hover {
  color: var(--text);
  background: var(--blue-mist);
}
.nav-mega-tab.active {
  color: var(--blue);
  background: var(--pure-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.nav-mega-tab.active svg {
  opacity: 1;
}

/* Footer links in left column */
.nav-mega-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-mega-footer a {
  display: block;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: background 0.15s ease;
}
.nav-mega-footer a:hover {
  background: var(--blue-hover);
}

/* Right column - panel content */
.nav-mega-right {
  flex: 1;
  padding: 8px;
  min-height: 0;
}
.nav-mega-panel {
  display: none;
}
.nav-mega-panel.active {
  display: block;
}

/* Links inside panels */
.nav-mega-link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}
.nav-mega-link:hover {
  background: var(--blue-hover);
}
.nav-mega-link-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.nav-mega-link-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.nav-mega-link-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.nav-mega-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 20px;
}
.nav-mega-tag--hrd {
  background: var(--blue-soft);
  color: var(--blue);
}
.nav-mega-tag--free {
  background: var(--green-tint);
  color: var(--green);
}

/* ---- Simple dropdown (Free Resources) ---- */
/* Match nav height so top: 100% lands exactly at the navbar bottom,
   letting us reuse the same 8px gap as the Products mega dropdown. */
.nav-dropdown--simple {
  position: relative;
  display: flex;
  align-items: center;
  height: 72px;
}
.nav-simple-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  min-width: 200px;
  background: var(--pure-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown--simple.open .nav-simple-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.nav-simple-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-simple-link:hover {
  background: var(--blue-hover);
  color: var(--blue);
}
.nav-simple-link svg { flex-shrink: 0; color: var(--muted); }
.nav-simple-link:hover svg { color: var(--blue); }

/* Nav CTA - hidden mobile */
.nav-cta { display: none; }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  z-index: 1001;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu overlay */
/* Mobile overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  backdrop-filter: blur(2px);
}
.mobile-overlay.open { opacity: 1; visibility: visible; }

/* Slide-in sidebar */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--white);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.mobile-close:hover { background: var(--border); }
.mobile-menu-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-menu-body > a {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 24px;
  text-decoration: none;
}
.mobile-menu-body > a:hover { background: var(--bg); color: var(--blue); }
.mobile-menu-body .btn {
  margin: 16px 24px 0;
  text-align: center;
  color: var(--white);
}
.mobile-menu-body .btn:hover { background: var(--amber); color: var(--white); }

/* Mobile accordion for courses */
.mobile-courses-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.mobile-courses-toggle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.mobile-courses-toggle:hover { background: var(--bg); }
.mobile-courses-toggle .chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.25s ease;
}
.mobile-courses-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}
.mobile-courses-list {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 0 0 4px;
  background: var(--bg);
}
.mobile-courses-list.open {
  display: flex;
}
.mobile-courses-list a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 24px 10px 36px;
  text-decoration: none;
}
.mobile-courses-list a:hover { color: var(--blue); background: var(--border); }
.mobile-courses-list .mobile-all-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  padding: 10px 24px 10px 36px;
}

/* Mobile Free Resources accordion (reuses courses-toggle pattern) */
.mobile-resources-toggle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.mobile-resources-toggle:hover { background: var(--bg); }
.mobile-resources-toggle .chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.25s ease;
}
.mobile-resources-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}
.mobile-resources-list {
  display: none;
  flex-direction: column;
  padding: 0 0 4px;
  background: var(--bg);
}
.mobile-resources-list.open { display: flex; }
.mobile-resources-list a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 24px 10px 36px;
  text-decoration: none;
}
.mobile-resources-list a:hover { color: var(--blue); background: var(--border); }

.mobile-about-list {
  display: none;
  flex-direction: column;
  padding: 0 0 4px;
  background: var(--bg);
}
.mobile-about-list.open { display: flex; }
.mobile-about-list a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 24px 10px 36px;
  text-decoration: none;
}
.mobile-about-list a:hover { color: var(--blue); background: var(--border); }

/* Tablet+ (768px) - show desktop nav */
@media (min-width: 768px) {
  .nav { height: 72px; }
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .hamburger { display: none; }
  .mobile-menu { display: none !important; }
  .mobile-overlay { display: none !important; }
}

@media (min-width: 1024px) {
  .nav-logo img { height: 28px; width: auto; }
  .nav-logo-text { font-size: 19px; }
  .nav-links { gap: 36px; }
  .nav-links > a,
  .nav-links > .nav-dropdown > .nav-dropdown-trigger {
    font-size: 16px;
  }
}

/* Nav spacer */
.hamburger:focus-visible, .mobile-close:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.nav-spacer { height: 64px; }
@media (min-width: 768px) { .nav-spacer { height: 72px; } }
