/* ========================================
   HEADER & NAVIGATION STYLES
   Separated from main style.css
   ======================================== */

/* ================================
   HEADER
================================ */
#header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  transition: all 0.5s;
  z-index: 997;
  background: transparent;
  box-shadow: none;
}

#header.header-scrolled {
  background: transparent;
}

/* Floating pill container */
#header .container {
  background: rgba(255, 255, 255);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  padding: 16px 20px;
  box-shadow: 0 18px 24px rgba(0,0,0,.2), 0 4px 4px rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,0.7);
  max-width: 1200px;
  transition: all 0.3s;
}

#header .container:hover {
  box-shadow: 0 8px 32px rgba(52,152,219,0.15), 0 2px 8px rgba(0,0,0,0.08);
}

#header .logo h1 {
  font-size: 28px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #384046;
}

#header .logo h1 a,
#header .logo h1 a:hover {
  color: #384046;
  text-decoration: none;
}

#header .logo img {
  max-height: 48px;
}

/* ================================
   HEADER SOCIAL LINKS
================================ */
.header-social-links {
  margin: 0 0 0 30px;
}

.header-social-links a {
  font-family: var(--primary_font);
  font-weight: 200;
  color: #9ba6af;
  padding-left: 8px;
  display: inline-block;
  line-height: 0px;
  transition: 0.3s;
}

.header-social-links a i {
  line-height: 0;
}

.header-social-links a:hover {
  color: #3498db;
}

@media (max-width: 768px) {
  .header-social-links {
    margin: 0 15px 0 0;
  }
}

/* ================================
   DESKTOP NAVIGATION
================================ */

/* Nav uses Open Sans */
.navbar a,
.navbar a:focus {
  font-family: var(--secondary_font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.navbar {
  padding: 0;
  overflow: visible;
  position: relative;
}

.navbar ul {
  margin: 0;
  padding: 0;
  display: flex;
  list-style: none;
  align-items: center;
  overflow: visible;
}

.navbar li {
  position: relative;
}

.navbar a,
.navbar a:focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 10px 30px;
  font-family: var(--secondary_font);
  font-size: 14px;
  color: #4f5a62;
  white-space: nowrap;
  transition: 0.3s;
}

.navbar a i,
.navbar a:focus i {
  line-height: 0;
}

.navbar a:hover,
.navbar .active,
.navbar .active:focus,
.navbar li:hover>a {
  color: #3498db;
}

/* Ensure active sub-menu links have visibility */
#navbar ul ul a.active {
  color: #5faee3;
}

/* Optional: Keep the parent dropdown visible or highlighted while viewing a child page */
#navbar li.dropdown.active > a {
  color: #5faee3; 
}

.navbar .dropdown ul {
  display: block;
  position: absolute;
  left: 14px;
  top: calc(100% + 30px);
  margin: 0;
  padding: 10px 0;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  background: #fff;
  box-shadow: 0px 0px 30px rgba(127, 137, 161, 0.25);
  transition: 0.3s;
}

.navbar .dropdown ul li {
  min-width: 200px;
}

.navbar .dropdown ul a {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 400;
  color: #21262a;
}

.navbar .dropdown ul a i {
  font-size: 12px;
}

.navbar .dropdown ul a:hover,
.navbar .dropdown ul .active:hover,
.navbar .dropdown ul li:hover>a {
  color: #3498db;
}

.navbar .dropdown:hover>ul {
  opacity: 1;
  top: 100%;
  visibility: visible;
}

.navbar .dropdown .dropdown ul {
  top: 0;
  left: calc(100% - 30px);
  visibility: hidden;
}

.navbar .dropdown .dropdown:hover>ul {
  opacity: 1;
  top: 0;
  left: 100%;
  visibility: visible;
}

/* ================================
   MEGA DROPDOWN MENU - Lattice Style
================================ */
.navbar .publications-popover {
  position: static;
}

/* Mega Dropdown Panel */
.navbar .publications-popover-panel {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 18px);
  width: max-content;
  max-height: calc(100vh - 120px);
  padding: 42px 48px;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-sizing: border-box;
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  transform: translateX(-50%) translateY(-8px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar styling for mega menu */
.navbar .publications-popover-panel::-webkit-scrollbar {
  width: 8px;
}

.navbar .publications-popover-panel::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.navbar .publications-popover-panel::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.navbar .publications-popover-panel::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.navbar .publications-popover:hover > .publications-popover-panel,
.navbar .publications-popover:focus-within > .publications-popover-panel,
.navbar .publications-popover.is-open > .publications-popover-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Mega Menu Grid Layout - Dynamic based on column count */
.publications-popover-grid {
  display: grid;
  gap: 0;
  row-gap: 0;
  align-items: start;
  box-sizing: border-box;
}

/* Dynamic widths for different column counts */
.publications-popover-grid[data-columns="1"] {
  grid-template-columns: 260px;
}

.publications-popover-grid[data-columns="2"] {
  grid-template-columns: repeat(2, 260px);
}

.publications-popover-grid[data-columns="3"] {
  grid-template-columns: repeat(3, 260px);
}

.publications-popover-grid[data-columns="4"] {
  grid-template-columns: repeat(4, 260px);
}

/* Fallback if no data-columns attribute */
.publications-popover-grid:not([data-columns]) {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Mega Menu Columns */
.publications-popover-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 0 24px;
  border-right: 1px solid #e8ecf0;
  overflow: hidden;
}

.publications-popover-column:last-child {
  border-right: none;
}

.publications-popover-column:first-child {
  padding-left: 0;
}

/* Section Headers */
.publications-popover-column h6 {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
  font-family: var(--secondary_font);
  line-height: 1.2;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu Item Link with Icon */
.publications-popover-column .nav-item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 8px;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
}

.publications-popover-column .nav-item-link:hover {
  background-color: #f8fafc;
}

/* Icon Container */
.nav-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.publications-popover-column .nav-item-link:hover .nav-item-icon {
  background: #e0f2fe;
  color: #3498db;
}

/* Text Container */
.nav-item-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

/* Title */
.nav-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  font-family: var(--secondary_font);
  line-height: 1.4;
  transition: color 0.2s ease;
  letter-spacing: -0.01em;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.publications-popover-column .nav-item-link:hover .nav-item-title {
  color: #3498db;
}

/* Description - Hidden but kept for potential future use */
.nav-item-desc {
  display: none;
}

/* Active State */
.publications-popover-column .nav-item-link.active .nav-item-title {
  color: #3498db;
}

/* "See all" link */
.publications-popover-column .nav-item-seeall {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  font-family: var(--secondary_font);
  text-decoration: none;
  transition: color 0.2s ease;
  border-radius: 8px;
}

.publications-popover-column .nav-item-seeall:hover {
  color: #3498db;
  background-color: #f8fafc;
}

.publications-popover-column .nav-item-seeall .seeall-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.publications-popover-column .nav-item-seeall:hover .seeall-icon {
  transform: translateX(4px);
  border-color: #3498db;
  color: #3498db;
}

/* Featured Section (Optional - for special highlights) */
.publications-popover-featured {
  grid-column: span 1;
  padding: 24px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

.publications-popover-featured h6 {
  color: #0369a1;
  margin-bottom: 12px;
}

.publications-popover-featured .featured-title {
  font-size: 17px;
  font-weight: 700;
  color: #0c4a6e;
  margin-bottom: 8px;
  line-height: 1.3;
}

.publications-popover-featured .featured-desc {
  font-size: 14px;
  color: #0369a1;
  line-height: 1.6;
  margin-bottom: 16px;
}

.publications-popover-featured .featured-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #0284c7;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.publications-popover-featured .featured-link:hover {
  background: #0369a1;
  transform: translateY(-2px);
}

/* ================================
   CONTACT BUTTON
================================ */
.contact-btn-nav {
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-btn-nav > a {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  color: #fff;
  background: linear-gradient(135deg, #0b74ff, #0058d8);
  box-shadow: 0 10px 30px rgba(11,116,255,.30);
  transition: background .35s ease, box-shadow .35s ease;
  animation: ctaAttention 4s ease-in-out infinite;
}

/* Hover */
.contact-btn-nav > a:hover {
  animation-play-state: paused;
  transform: translateY(-3px) scale(1.04);
  background: linear-gradient(135deg, #2f8dff, #0b74ff);
  box-shadow: 0 18px 42px rgba(11,116,255,.45);
}

/* Active */
.contact-btn-nav > a:active {
  transform: translateY(0) scale(.98);
}

.contact-icon {
  display: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Arrow Icon */
.arrow-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform .45s ease;
}

.contact-btn-nav > a:hover .arrow-icon {
  transform: translateX(6px);
}

/* Shine Effect */
.shine-effect {
  position: absolute;
  top: -50%;
  left: -90px;
  width: 40px;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  transform: rotate(25deg);
  pointer-events: none;
  animation: shineSweep 4s ease-in-out infinite;
}

@keyframes shineSweep {
  0%, 15% {
    left: -90px;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  40% {
    left: calc(100% + 90px);
    opacity: 1;
  }
  45% {
    left: calc(100% + 90px);
    opacity: 0;
  }
  100% {
    left: calc(100% + 90px);
    opacity: 0;
  }
}

/* Button Attention Animation */
@keyframes ctaAttention {
  0%, 18% {
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 30px rgba(11,116,255,.30);
  }
  22% {
    transform: translateY(-4px) scale(1.04);
  }
  26% {
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-2px);
  }
  34% {
    transform: translateY(0);
  }
  52% {
    box-shadow: 0 0 0 0 rgba(11,116,255,.40), 0 15px 40px rgba(11,116,255,.55);
  }
  68% {
    box-shadow: 0 0 0 12px rgba(11,116,255,0), 0 10px 30px rgba(11,116,255,.30);
  }
  78% {
    transform: translateX(-2px) rotate(-1deg);
  }
  82% {
    transform: translateX(2px) rotate(1deg);
  }
  86% {
    transform: translateX(-1px);
  }
  90% {
    transform: translateX(0);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 30px rgba(11,116,255,.30);
  }
}

.contact-btn-nav.paused > a,
.contact-btn-nav.paused .shine-effect {
  animation-play-state: paused !important;
}

/* ================================
   MOBILE DRAWER MENU
================================ */
.mobile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 380px;
  height: 100%;
  max-height: 100vh;
  background: #ffffff;
  z-index: 999;
  overflow-y: auto;
  overflow-x: hidden;
  transition: right 0.3s ease;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Custom scrollbar for mobile drawer */
.mobile-drawer-menu::-webkit-scrollbar {
  width: 6px;
}

.mobile-drawer-menu::-webkit-scrollbar-track {
  background: #f8fafc;
}

.mobile-drawer-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.mobile-drawer-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.mobile-drawer-menu.active {
  right: 0;
}

/* Prevent body scroll when drawer is open */
body.mobile-drawer-open {
  overflow: hidden;
}

/* Drawer Header */
.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.mobile-drawer-logo img {
  max-height: 36px;
}

.mobile-drawer-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  color: #64748b;
  font-size: 20px;
}

.mobile-drawer-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Drawer Content */
.mobile-drawer-content {
  padding: 0;
}

.mobile-drawer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-drawer-nav > li {
  border-bottom: 1px solid #f1f5f9;
}

.mobile-drawer-nav > li > a {
  display: block;
  padding: 16px 24px;
  color: #1e293b;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  font-family: var(--secondary_font);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-drawer-nav > li > a:hover,
.mobile-drawer-nav > li > a.active {
  background: #f8fafc;
  color: #3498db;
}

/* Mobile Dropdown */
.mobile-drawer-dropdown-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.mobile-drawer-dropdown-toggle i {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.mobile-drawer-dropdown.open > a i {
  transform: rotate(180deg);
}

/* Mobile Submenu */
.mobile-drawer-submenu {
  max-height: 0;
  overflow: hidden;
  background: #f8fafc;
  transition: max-height 0.3s ease;
}

.mobile-drawer-dropdown.open .mobile-drawer-submenu {
  max-height: 1000px;
}

.mobile-drawer-submenu-section {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
}

.mobile-drawer-submenu-section:first-child {
  border-top: none;
}

.mobile-drawer-submenu-section h6 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  font-weight: 700;
  margin: 0 0 12px;
  font-family: var(--secondary_font);
}

.mobile-drawer-submenu-section a {
  display: block;
  padding: 10px 0;
  color: #475569;
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  font-family: var(--secondary_font);
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-drawer-submenu-section a:hover,
.mobile-drawer-submenu-section a.active {
  color: #3498db;
  padding-left: 8px;
}

/* ================================
   MOBILE NAVIGATION
================================ */
.mobile-nav-toggle {
  color: #384046;
  font-size: 28px;
  cursor: pointer;
  display: none !important;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  transition: 0.5s;
  margin-left: 8px;
}

.mobile-nav-toggle i {
  font-size: 28px;
  line-height: 1;
}

.mobile-nav-toggle:hover {
  color: #3498db;
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 1366px) {
  .navbar .dropdown .dropdown ul {
    left: -90%;
  }

  .navbar .dropdown .dropdown:hover>ul {
    left: -100%;
  }
}

@media (max-width: 1250px) {
  #header .container {
    margin: 0 30px;
  }
}

@media (max-width: 1090px) {
  #header .container {
    margin: 0 30px;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  /* Medium desktops/large tablets - show mega menu but with adjustments */
  .navbar .publications-popover-panel {
    padding: 32px 36px;
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  .publications-popover-grid[data-columns="4"] {
    grid-template-columns: repeat(2, 240px);
    row-gap: 28px;
  }

  .publications-popover-grid[data-columns="3"] {
    grid-template-columns: repeat(2, 240px);
    row-gap: 28px;
  }

  .publications-popover-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 240px);
    row-gap: 0;
  }

  .publications-popover-grid[data-columns="1"] {
    grid-template-columns: 240px;
    row-gap: 0;
  }

  .publications-popover-column {
    padding: 0 18px;
  }

  .publications-popover-column:first-child {
    padding-left: 0;
  }

  .publications-popover-column:nth-child(2n) {
    border-right: none;
  }

  .publications-popover-column:nth-child(2n+1):not(:last-child) {
    border-right: 1px solid #e8ecf0;
  }
}

@media (max-width: 991px) {
  /* Show mobile toggle */
  .mobile-nav-toggle {
    display: inline-flex !important;
  }

  /* Hide desktop mega menu completely on mobile */
  .navbar .publications-popover-panel {
    display: none !important;
  }

  /* Hide contact button on mobile */
  .contact-btn-nav {
    display: none;
  }

  #header .container {
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    padding: 14px 16px;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
  }

  #header .logo img {
    max-height: 38px;
  }

  .navbar {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    min-width: 0;
  }

  .navbar ul {
    display: none;
  }

  .contact-btn-nav {
    order: 3;
    width: auto;
  }
}

@media (max-height: 700px) {
  /* For short viewport heights - reduce padding */
  .navbar .publications-popover-panel {
    padding: 28px 36px;
    max-height: calc(100vh - 80px);
  }
}

@media (max-height: 550px) {
  /* For very short viewport heights - minimal padding */
  .navbar .publications-popover-panel {
    padding: 20px 28px;
    max-height: calc(100vh - 60px);
  }

  .publications-popover-column h6 {
    margin-bottom: 12px;
    padding-bottom: 6px;
  }

  .publications-popover-column .nav-item-link {
    padding: 6px 10px;
  }
}

@media (max-width: 640px) {
  /* Mobile drawer styling handled above */
  .mobile-drawer-menu {
    width: 90%;
    max-width: 320px;
  }
}