/* ===== MEGAMENU STYLING ===== */
/* Enhanced dropdown menus inspired by Posit.co */

/* Base dropdown container */
.navbar .dropdown-menu,
#quarto-header .dropdown-menu {
  min-width: 280px;
  padding: 1rem 0;
  border-radius: 12px;
  animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== LEARN MEGAMENU - HORIZONTAL TWO-COLUMN LAYOUT ===== */
.navbar .nav-item:nth-child(2) .dropdown-menu,
.navbar .dropdown-menu.megamenu-learn {
  min-width: 520px;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Megamenu columns */
.megamenu-column {
  display: flex;
  flex-direction: column;
}

.megamenu-column:first-child {
  border-right: 1px solid rgba(56, 189, 248, 0.15);
  padding-right: 1.5rem;
}

.megamenu-column:last-child {
  padding-left: 0.5rem;
}

/* Column headers */
.megamenu-header {
  color: #38BDF8 !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0 0 0.75rem 0 !important;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  pointer-events: none;
}

.megamenu-header:hover {
  background: transparent !important;
  padding-left: 0 !important;
}

/* Megamenu items */
.megamenu-column .dropdown-item {
  padding: 0.5rem 0.75rem !important;
  border-radius: 6px;
  margin-bottom: 0.25rem;
}

.megamenu-column .dropdown-item:hover {
  padding-left: 1rem !important;
}

/* Section headers in dropdown (bold items) - fallback */
.navbar .dropdown-menu .dropdown-item strong,
.navbar .dropdown-menu .dropdown-item b {
  color: #38BDF8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  padding: 0.25rem 0;
}

/* Style for section header links */
.navbar .dropdown-menu .dropdown-item:has(strong),
.navbar .dropdown-menu .dropdown-item:has(b) {
  padding-top: 0.75rem;
  padding-bottom: 0.25rem;
  background: transparent !important;
  cursor: default;
}

.navbar .dropdown-menu .dropdown-item:has(strong):hover,
.navbar .dropdown-menu .dropdown-item:has(b):hover {
  background: transparent !important;
  color: #38BDF8 !important;
  padding-left: 1.5rem !important;
}

/* Hide dividers in megamenu */
.navbar .nav-item:nth-child(2) .dropdown-menu .dropdown-divider,
.megamenu-learn .dropdown-divider {
  display: none;
}

/* Dropdown dividers for other menus */
.navbar .dropdown-menu .dropdown-divider,
.navbar .dropdown-menu hr {
  margin: 0.5rem 1rem;
  border-color: rgba(56, 189, 248, 0.15);
}

/* Regular dropdown items */
.navbar .dropdown-item,
#quarto-header .dropdown-item {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.2s ease;
}

.navbar .dropdown-item:hover,
#quarto-header .dropdown-item:hover {
  background: rgba(56, 189, 248, 0.1) !important;
  color: #38BDF8 !important;
  padding-left: 1.75rem;
}

/* External link indicator */
.navbar .dropdown-item[href*="youtube"],
.navbar .dropdown-item[href*="facebook"],
.navbar .dropdown-item[href*="medium"],
.navbar .dropdown-item[href*="store.pystatrplus"] {
  position: relative;
}

.navbar .dropdown-item[href*="youtube"]::after,
.navbar .dropdown-item[href*="facebook"]::after,
.navbar .dropdown-item[href*="medium"]::after,
.navbar .dropdown-item[href*="store.pystatrplus"]::after {
  content: "↗";
  position: absolute;
  right: 0.5rem;
  opacity: 0.5;
  font-size: 0.8rem;
}

/* Platform-specific hover colors */
.navbar .dropdown-item[href*="youtube"]:hover {
  background: rgba(255, 215, 0, 0.1) !important;
  color: #FFD700 !important;
}

.navbar .dropdown-item[href*="facebook"]:hover {
  background: rgba(24, 119, 242, 0.1) !important;
  color: #1877F2 !important;
}

.navbar .dropdown-item[href*="medium"]:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #ffffff !important;
}

/* Products dropdown - styled for CTA */
.navbar .dropdown-item[href*="store.pystatrplus"] {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  margin-left: 0.75rem;
  margin-right: 0.75rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(59, 130, 246, 0.15)) !important;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
}

.navbar .dropdown-item[href*="store.pystatrplus"]:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(59, 130, 246, 0.25)) !important;
  padding-left: 1.5rem;
}

/* Dropdown caret animation */
.navbar .dropdown-toggle::after {
  transition: transform 0.2s ease;
}

.navbar .dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 991.98px) {
  .navbar .dropdown-menu {
    min-width: 100%;
    background: rgba(11, 17, 32, 0.98) !important;
    border: none;
    border-radius: 0;
    margin-top: 0;
  }

  /* Reset megamenu to single column on mobile — only when shown */
  .navbar .nav-item:nth-child(2) .dropdown-menu.show,
  .navbar .dropdown-menu.megamenu-learn.show {
    display: block !important;
    min-width: 100%;
    padding: 0.5rem 0;
  }

  .megamenu-column {
    border-right: none !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
  }

  .megamenu-column:first-child {
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .navbar .dropdown-item {
    padding: 0.75rem 1rem;
  }

  .navbar .dropdown-item:hover {
    padding-left: 1.25rem;
  }

  .megamenu-header {
    padding: 0.5rem 1rem !important;
  }
}

/* Active state for dropdown parent */
.navbar .nav-item.dropdown:has(.dropdown-menu.show) .nav-link {
  color: #38BDF8 !important;
}
