/* ===============================
   HEADER LAYOUT & GENERAL STYLES
   =============================== */

/* Remove unwanted bottom spacing */
header {
  background: #ffffff !important;
  border-bottom: 1px solid #e0e0e0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
  margin-bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  /* prevent overlap */
  will-change: auto !important;
  /* prevent flickering */
  transform: translateZ(0) !important;
  /* hardware acceleration */
  backface-visibility: hidden !important;
  /* prevent flicker */
}

/* Ensure header grid remains fixed height */
.header-grid {
  width: 100% !important;
  max-width: 100% !important;
}

/* ===============================
   PAGE CONTAINER & BODY FIXES
   =============================== */
html,
body {
  margin: 0;
  padding: 0;
  height: auto !important;
  min-height: 100%;
  overflow-y: scroll !important;
  /* always show vertical scroll */
}

.page-container {
  display: block !important;
  min-height: auto !important;
  margin: 0;
  padding: 0;
}

/* ===============================
   HEADER CELL ALIGNMENT
   =============================== */
.cell.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  /* REDUCED: Compact padding for 80px height */
  padding: 5px 20px !important;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  gap: 15px;
  /* FORCE 80px HEIGHT */
  height: 80px !important;
  max-height: 80px !important;
  min-height: 80px !important;
}

.cell.center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px !important;
  /* Tight spacing between nav buttons */
  position: relative;
}

.cell.right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  flex: 0 0 auto;
  /* prevents stretching */
}

/* ===============================
   NAVIGATION DROPDOWN GRID
   =============================== */
.nav-item.position-relative,
.nav-item {
  position: relative !important;
  /* Anchor for absolute dropdown */
  margin: 0 !important;
  /* No margin - tight spacing */
  padding: 0 !important;
  /* No padding */
  display: flex !important;
  /* Flex item in flex container */
  flex-direction: row !important;
  /* Horizontal */
  align-items: center !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  width: auto !important;
  height: auto !important;
}

/* Hidden dropdown container - FIXED POSITIONING - COMPLETELY REMOVED FROM DOCUMENT FLOW */
.nav-item-grid {
  display: none !important;
  position: fixed !important;
  /* FIXED - Completely removed from document flow, overlays everything */
  top: -9999px !important;
  /* Hide off-screen when not active */
  left: -9999px !important;
  /* Hide off-screen when not active */
  width: 420px !important;
  /* HARD FIXED WIDTH - NO EXPANSION */
  min-width: 420px !important;
  max-width: 420px !important;
  /* HARD MAX - prevents any expansion */
  background: #fff !important;
  padding: 10px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
  z-index: 100000 !important;
  /* Very high - floats above content */
  margin: 0 !important;
  /* NO MARGIN - prevents pushing content */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  will-change: auto !important;
  /* NO WILL-CHANGE - prevents flickering */
  transform: none !important;
  /* NO TRANSFORM - prevents flickering */
  backface-visibility: visible !important;
  /* Prevent flickering */
  transition: none !important;
  /* NO TRANSITIONS - prevents flickering */
  pointer-events: none !important;
  /* CRITICAL - Disable when hidden, don't block clicks */
  overflow: hidden !important;
  /* HARD - Prevent expansion */
  overflow-x: hidden !important;
  /* HARD - Prevent horizontal scroll */
  overflow-y: auto !important;
  /* Allow vertical scroll if needed */
  max-height: 80vh !important;
  /* Prevent vertical expansion */
  box-sizing: border-box !important;
  /* Include padding in width */
  contain: strict !important;
  /* STRICT CONTAINMENT - Isolate from document flow */
  resize: none !important;
  /* Prevent resizing */
  /* CRITICAL: Ensure it doesn't affect layout at all */
  float: none !important;
  clear: none !important;
  isolation: isolate !important;
  /* Create new stacking context */
}

/* CRITICAL OVERRIDE: Force fixed positioning - NEVER allow absolute */
.nav-item:hover .nav-item-grid,
.nav-item-grid:hover,
.nav-item-grid.active {
  position: fixed !important;
  /* ALWAYS FIXED - NEVER ABSOLUTE */
  pointer-events: auto !important;
  /* Only when visible */
}

/* Show dropdown on hover - DISABLED - JavaScript handles with FIXED positioning */
/* CRITICAL: This was causing buttons to move - completely disabled */
/* .nav-btn:not(.home-btn):hover .nav-item-grid,
.nav-item:hover .nav-item-grid {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: absolute !important;
  margin: 0 !important;
  margin-top: 0 !important;
  top: 100% !important;
  left: 0 !important;
  transform: translateZ(0) !important;
  backface-visibility: hidden !important;
} */

/* CRITICAL OVERRIDE: Force fixed positioning - NEVER allow absolute */
.nav-item:hover .nav-item-grid,
.nav-item-grid,
.nav-item-grid:hover,
.nav-btn:hover .nav-item-grid {
  position: fixed !important;
  /* ALWAYS FIXED - NEVER ABSOLUTE */
}

/* Prevent flickering on navigation buttons */
.nav-btn {
  will-change: auto !important;
  transform: translateZ(0) !important;
  backface-visibility: hidden !important;
  transition: none !important;
  /* remove transitions that cause flicker */
  margin: 0 !important;
  /* Tight spacing */
  padding: 6px 12px !important;
  /* Tighter padding for compact header */
  padding: 4px 8px !important;
  /* Inline flex for horizontal layout */
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  /* Tight gap inside button */
  white-space: nowrap !important;
  /* Don't wrap text */
  width: auto !important;
  /* Auto width */
  height: auto !important;
  /* Auto height */
  min-width: auto !important;
  min-height: auto !important;
  line-height: normal !important;
  /* Normal line height */
  text-decoration: none !important;
  color: inherit !important;
  visibility: visible !important;
  /* Ensure visibility */
  opacity: 1 !important;
  /* Ensure opacity */
}

/* Ensure nav items don't have extra spacing and don't expand - CONSOLIDATED */
.nav-item {
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  /* For positioning reference */
  display: flex !important;
  /* Flex item in flex container */
  flex-direction: row !important;
  /* Horizontal */
  align-items: center !important;
  height: auto !important;
  /* Natural height - don't expand for mega menu */
  min-height: auto !important;
  max-height: none !important;
  width: auto !important;
  /* Auto width */
  overflow: visible !important;
  /* Allow mega menu to overflow */
  z-index: auto !important;
  contain: layout style paint !important;
  /* CRITICAL - Prevent layout changes from mega menu */
  flex-shrink: 0 !important;
  /* Don't shrink in flex container - FIXED POSITION */
  flex-grow: 0 !important;
  /* Don't grow in flex container - FIXED POSITION */
  flex-basis: auto !important;
  /* Natural size */
  align-self: center !important;
  /* Center align in flex container */
  visibility: visible !important;
  /* Ensure visibility */
  opacity: 1 !important;
  /* Ensure opacity */
  top: 0 !important;
  /* Don't move down */
  left: auto !important;
  /* Natural position */
  float: none !important;
  /* No float */
  clear: none !important;
  /* No clear */
}

/* Individual grid items */
.nav-item-grid .grid-item {
  text-align: center;
  font-size: 12px;
}

/* Grid images */
.nav-item-grid .grid-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 5px;
}

/* Navigator grid general visibility control - ABSOLUTE - NO DOCUMENT FLOW */
.navigator-grid {
  display: none !important;
  position: absolute !important;
  /* CRITICAL: Remove from document flow */
  z-index: 1000 !important;
  margin: 0 !important;
  /* No margin */
  margin-top: 0 !important;
  top: 100% !important;
  left: 0 !important;
}

/* Mega menu grid - also absolute */
.mega-menu-grid {
  position: relative !important;
  /* Relative to nav-item-grid */
  margin: 0 !important;
  padding: 0 !important;
}

/* ===============================
   FOOTER BEHAVIOR
   =============================== */
footer {
  margin-top: auto;
  /* keeps footer pushed down */
}

/* ===============================
   PREVENT CONTENT SHIFT FROM MEGA MENU
   =============================== */
/* Ensure mega menu dropdowns don't affect page layout - CRITICAL FIX */
.nav-item-grid,
.navigator-grid {
  position: absolute !important;
  /* CRITICAL: Remove from document flow */
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  top: 100% !important;
  /* Position below nav button */
  left: 0 !important;
}

/* Mega menu grid is relative to nav-item-grid, not document - HARD FIXED WIDTH */
.mega-menu-grid {
  position: relative !important;
  /* Relative to nav-item-grid */
  display: grid !important;
  /* CRITICAL: Grid layout for mega menu */
  grid-template-columns: repeat(2, 1fr) !important;
  /* 2 columns */
  gap: 8px 16px !important;
  /* Row and column gaps */
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  /* Full width of nav-item-grid */
  max-width: 100% !important;
  /* HARD - Don't exceed parent */
  min-width: 0 !important;
  /* Allow grid to shrink */
  box-sizing: border-box !important;
  overflow: hidden !important;
  /* HARD - Prevent expansion */
  overflow-x: hidden !important;
  /* HARD - Prevent horizontal scroll */
  word-wrap: break-word !important;
  /* Break long words */
  word-break: break-word !important;
  /* Break words if needed */
  contain: layout style paint !important;
  /* Strict containment */
}

/* Ensure grid items don't expand beyond container */
.mega-menu-grid>* {
  min-width: 0 !important;
  /* Allow grid items to shrink */
  max-width: 100% !important;
  /* HARD - Don't exceed grid cell */
  overflow: hidden !important;
  /* Prevent content overflow */
  word-wrap: break-word !important;
  /* Break long words */
  word-break: break-word !important;
  /* Break words if needed */
  box-sizing: border-box !important;
}

/* Mega menu links - prevent expansion */
.mega-menu-grid a {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  /* Prevent text wrapping that could expand */
  box-sizing: border-box !important;
}

/* Ensure header doesn't grow when mega menu appears - FIXED HEIGHT */
/* Ensure header doesn't grow when mega menu appears - FIXED HEIGHT */
header,
.header-container {
  position: relative !important;
  overflow: visible !important;
  /* Allow mega menu to overflow */
  z-index: 10000 !important;
  /* Header above sidebar */
  /* FORCE 80px HEIGHT */
  height: 80px !important;
  max-height: 80px !important;
  min-height: 80px !important;
}

.header-second-row {
  position: relative !important;
  display: flex !important;
  /* Ensure flex layout */
  flex-direction: row !important;
  /* Horizontal */
  align-items: center !important;
  /* Center items vertically */
  justify-content: center !important;
  /* Center items horizontally */
  height: auto !important;
  /* Reduced height for 80px header */
  min-height: 34px !important;
  max-height: 34px !important;
  overflow: visible !important;
  /* Allow mega menu to overflow */
  contain: none !important;
  /* Remove containment to allow proper flex layout */
}

.header-center {
  position: relative !important;
  display: flex !important;
  /* CRITICAL: Horizontal layout */
  flex-direction: row !important;
  /* Horizontal direction */
  flex-wrap: nowrap !important;
  /* Don't wrap to new line */
  align-items: center !important;
  /* Center vertically */
  justify-content: center !important;
  /* Center horizontally */
  gap: 8px !important;
  /* Tighter spacing for compact header */
  gap: 4px !important;
  /* Reduced height for 80px header */
  min-height: 36px !important;
  max-height: 36px !important;
  width: auto !important;
  overflow: visible !important;
  /* Allow mega menu to overflow */
  contain: none !important;
  /* Remove containment to allow proper flex layout */
}

/* REMOVED: Duplicate .nav-item rule - using consolidated version above */

/* Main content should not be affected by mega menu */
.main-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
  position: relative !important;
  clear: both !important;
  top: 0 !important;
  /* Start at top, not pushed down */
}

/* CRITICAL: Ensure mega menu never affects document flow - FINAL FIX */
/* UFO Panel styles removed - now handled in ufo_control_panel.php */

/* ================================================================
   FIX: Search-bar row (row 2) drifting up into row 1 on some pages
   The middle panel is a flex-column container (76px tall).
   When the top-bar or search row grows slightly (e.g. due to page-
   specific content), flex compression pushes the nav row up.
   Solution: anchor the nav row to the bottom of the panel with
   margin-top:auto and align-self:flex-end so it always stays below.
   ================================================================ */

/* Lock the top-bar to a fixed height so it never steals extra space (desktop only) */
@media (min-width: 981px) {
#headerMiddlePanel .header-top-bar,
.header-top-bar {
  flex-shrink: 0 !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

/* Lock the search row to a fixed height */
#headerMiddlePanel .header-row1,
.header-row1 {
  flex-shrink: 0 !important;
  min-height: 28px !important;
  max-height: 36px !important;
  box-sizing: border-box !important;
}

/* Anchor the nav-link row (row 2) to the absolute bottom of the panel.
   margin-top: auto in a flex-column pushes it down past everything above. */
#headerMiddlePanel .header-second-row,
#headerSecondRow {
  align-self: flex-end !important;
  /* Push to bottom of the flex-column container */
  margin-top: auto !important;
  /* Do not let it overlap row 1 by having a minimum separation */
  padding-top: 0 !important;
  margin-bottom: 2px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  /* Hard lock on height so it never grows and accidentally overlaps */
  min-height: 20px !important;
  max-height: 24px !important;
  height: 20px !important;
  /* Ensure it stays within the panel visually */
  position: relative !important;
  z-index: 10000 !important;
  overflow: visible !important;
  /* Allow dropdown menus to overflow */
}
}

/* On desktop, also ensure the middle panel is a proper flex column */
@media (min-width: 981px) {
  #headerMiddlePanel {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    height: 76px !important;
    min-height: 76px !important;
    max-height: 76px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
}

/* Mobile: hide the search row (header-row1 is already hidden by mobile-enhancements.css),
   ensure the nav row fills available space properly */
@media (max-width: 980px) {

  #headerMiddlePanel .header-second-row,
  #headerSecondRow {
    margin-top: 0 !important;
    align-self: auto !important;
    margin-left: 0 !important;
    /* Override desktop left-margin hack */
  }
}

/* 5. Mobile: Force Desktop-like Layout but with Responsive Scaling */
@media (max-width: 980px) {

  #headerMiddlePanel .header-top-bar,
  .header-top-bar {
    overflow: visible !important;
    height: auto !important;
    min-height: 14px !important;
    max-height: none !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #headerMiddlePanel .header-second-row,
  #headerSecondRow {
    margin-top: 0 !important;
    align-self: auto !important;
    padding: 0 5px !important;
    /* Reduce 220px padding */
    left: 0 !important;
    /* Remove 125px offset */
    width: 100% !important;
    justify-content: center !important;
  }

  /* Reduce large horizontal paddings that break mobile */
  .hamburger-search-wrapper {
    padding-left: 30px !important;
    padding-right: 0 !important;
  }

  .search-filter-container {
    min-width: 0 !important;
    /* Remove 825px min-width */
    width: 100% !important;
  }

  #searchWrapper {
    min-width: 0 !important;
    /* Remove 743px min-width */
    flex: 1 !important;
  }

  #searchForm .search-box {
    min-width: 0 !important;
  }

  /* Make header ultra-compact to fit everything on mobile */
  #mainHeader {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 2px !important;
    overflow: visible !important;
  }

  #headerMiddlePanel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    overflow: visible !important;
    justify-content: flex-start !important;
    padding-top: 0 !important;
  }

  #headerMiddlePanel > .header-top-bar {
    order: 1 !important;
    top: -5px !important;
    margin-top: 0 !important;
    margin-bottom: -5px !important;
  }

  #headerMiddlePanel > .header-row1,
  #headerMiddlePanel > .mobile-header-row1 {
    order: 2 !important;
  }

  #headerMiddlePanel > #headerSecondRow,
  #headerMiddlePanel > .header-second-row {
    order: 3 !important;
  }

  /* Reset desktop offsets that shift content off-screen on mobile */
  #mainHeader #headerSecondRow,
  .header-second-row {
    margin-top: 0 !important;
    left: 0 !important;
    margin-left: 0 !important;
    padding: 0 5px !important;
    width: 100% !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
  }

  /* Make logo smaller to fit alongside search */
  .logo-wrapper img {
    height: 24px !important;
    width: auto !important;
  }

  .logo-expanded-title {
    display: none !important;
    /* Hide title text on mobile to save space */
  }
}


/* ============================================================ 
   GLOBAL STANDARDIZATION: Aeris Floating UI & Chat Suite
   Ensures ALL floating panels (AI Chat, Smartphone, Freebies)
   stay fixed to the viewport and are NEVER hidden by layout containers.
   ============================================================ */
/* Always-visible panels — beacon, AI chat, smartphone, freebies stay on screen */
#ufoPremiumAIChat, 
#ufoPanelSmartphone, 
#ufoPanelFreebies,
#glrcf_assist_beacon {
    position: fixed !important;
    z-index: 2147483647 !important;
    display: flex;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* JS-toggled panels — CSS must NOT force visibility (JS toggle controls open/close state) */
#ufoPanelTV,
#ufoPanelNotifications,
#ufoPanelQuickChat {
    position: fixed !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
    /* display/visibility/opacity controlled exclusively by toggleTVPanel() and friends */
}

/* Specific positioning for floating panels when independent */
.ufo-control-panel-independent {
    top: 100px !important;
    right: 30px !important;
    pointer-events: auto !important;
}

/* Force ALL children of independent panels to be interactive */
.ufo-control-panel-independent * {
    pointer-events: auto !important;
}

/* Ensure the beacon is always in the bottom right corner (safe-area aware; footer uses higher-specificity #id rules) */
#glrcf_assist_beacon, .glrcf-assist-beacon {
    bottom: max(30px, env(safe-area-inset-bottom, 0px)) !important;
    right: calc(max(10px, env(safe-area-inset-right, 0px)) - 20px) !important;
    left: auto !important;
    top: auto !important;
}

/* NUCLEAR OVERRIDE: Prevent any legacy elements from hiding these */
#mainHeader, #mainFooter, .main-container, .content-wrapper, .ufo-layout-engine {
    overflow: visible !important;
}

/* AGGRESSIVE LEGACY CHAT HIDING */
/* Hide ANY old chat bubbles that might conflict with the new Aeris suite */
#floatingChatToggle, #floatingChatWidget, #chat-widget-container, .fb_dialog, .fb-customer-chat {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* === WHITE PANEL + BRAND ACCENT THEME (auto-applied) ===
   RULE: border on #headerMiddlePanel ONLY. Never on <header> or #mainHeader.
   === */
:root {
    --glrcf-header-bg: #ffffff;
    --glrcf-middle-bg: #ffffff;
    --glrcf-footer-bg: #ffffff;
    --ufo-panel-bg: #ffffff;
    --glrcf-header-fg: #059669;
    --glrcf-footer-fg: #059669;
    --glrcf-header-border: #059669;
    --glrcf-footer-border: #059669;
}

/* The VISIBLE center panel: white + brand border */
#headerMiddlePanel,
.header-middle-panel {
    background: #ffffff !important;
    background-image: none !important;
    border: 2px solid #059669 !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important;
}

/* The full-width transparent wrapper: NO border, NO background */
header, #mainHeader {
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* UFO side covers: white, borderless */
#ufoControlPanel, #ufoControlPanelLeft {
    background: #ffffff !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Nav link colors */
#mainHeader a, #mainHeader i, #mainHeader .nav-btn, #mainHeader .top-bar-link,
#headerMiddlePanel a, #headerMiddlePanel i, #headerMiddlePanel .nav-btn {
    color: #059669 !important;
}

/* Footer */
footer, #mainFooter, .main-footer, .site-footer {
    background: #ffffff !important;
    background-image: none !important;
    border-top: 3px solid #059669 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
}
footer *, #mainFooter * { color: #059669 !important; }
/* === END WHITE PANEL + BRAND ACCENT THEME === */

/* ===== MODERN LOGO STYLING ===== */
.logo-heading-box {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

/* Show logo text with image */
.logo-text-optional {
    display: flex !important;
}

.logo-heading-box {
    gap: 12px !important;
}

.logo-heading-box:hover {
    transform: translateY(-1px);
    background: rgba(66, 133, 244, 0.05);
}

.logo-heading-box:active {
    transform: translateY(0);
}

/* Logo Image Enhancements */
.logo-image-wrapper {
    position: relative;
    flex-shrink: 0;
}

.logo-img {
    height: 52px;
    width: auto;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    /* Restore original sharp thin lines with yellow/red-brown gold metallic look */
    filter: drop-shadow(0 1px 1px rgba(139, 69, 19, 0.3)) drop-shadow(0 0 1px rgba(255, 215, 0, 0.2)) !important;
}

.logo-heading-box:hover .logo-img {
    transform: scale(1.05) rotate(2deg);
    filter: drop-shadow(0 4px 8px rgba(66, 133, 244, 0.3));
}

/* Glow Effect */
.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.4) 0%, rgba(0, 64, 128, 0.2) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.logo-heading-box:hover .logo-glow {
    opacity: 1;
}

/* Typography Improvements */
.logo-heading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    gap: 2px;
}

.site-name {
    font-size: 20px;
    font-weight: 800;
    color: #004080;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.logo-heading-box:hover .site-name {
    color: #4285F4;
    text-shadow: 0 2px 4px rgba(66, 133, 244, 0.3);
}

.site-subtitle {
    font-size: 16px;
    font-weight: 700;
    color: #004080;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
    margin-bottom: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.logo-heading-box:hover .site-subtitle {
    color: #4285F4;
}

.site-small {
    font-size: 12px;
    font-weight: 600;
    color: #4285F4;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: color 0.3s ease;
    margin-bottom: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.site-title {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffd700 0%, #e6b800 40%, #b8860b 60%, #ffe680 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.12);
}

.logo-heading-box:hover .site-small {
    color: #004080;
}

/* Responsive Logo Sizing */
@media (max-width: 1024px) {
    .logo-img {
        height: 40px;
    }
    .site-title { font-size: 26px; }
}

@media (max-width: 768px) {
    .logo-img {
        height: 34px;
    }
    .site-title { font-size: 22px; }
    .logo-heading-box {
        gap: 10px;
        padding: 2px 4px;
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 30px;
    }
    .site-title { font-size: 18px; }
    .logo-heading-box {
        gap: 8px;
    }
}

/* Animation for Page Load */
@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-heading-box {
    animation: logoFadeIn 0.5s ease-out;
}

/* Hide site-title text */
.site-title {
    display: none !important;
}

/* Fix page layout */

.cell.center {
  flex: 1 !important;
  /* take all available space */
  display: flex !important;
  justify-content: center !important;
  /* keeps nav links centered in column */
  align-items: center !important;
  gap: 5px !important;
  /* TIGHT SPACING - buttons close together */
  position: relative !important;
  /* for dropdown absolute positioning */
}

.cell.right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  /* aligns icons to the right */
  flex: 0 0 auto;
  /* prevent it from expanding */
}

html,
body {
  margin: 0;
  padding: 0;
  height: auto !important;
  /* ensure body can grow */
  min-height: 100%;
  overflow-y: scroll !important;
  /* force vertical scroll */
}

.page-container {
  display: block !important;
  /* disable flex temporarily */
  min-height: auto !important;
  /* allow natural height */
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  contain: none !important;
  will-change: auto !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

.page-container {
  margin: 0;
  padding: 0;
}

header {
  margin: 0;
  padding: 0;
}

header,
main,
footer {
  position: relative !important;
  /* prevent overlap from absolute elements */
}

/* Ensures header grid stays fixed height */
.header-grid {
  width: 100% !important;
  max-width: 100% !important;
}

.nav-item-grid {
  display: none !important;
  position: absolute !important;
  /* ABSOLUTE - Removed from document flow */
  top: 100% !important;
  /* Below nav button */
  left: 0 !important;
  /* Align with nav button */
  width: auto !important;
  min-width: 420px !important;
  max-width: 600px !important;
  background: #fff !important;
  padding: 10px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
  z-index: 100000 !important;
  /* Very high - floats above content */
  margin: 0 !important;
  /* NO MARGIN - prevents pushing content */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow: hidden !important;
  /* Prevent expansion */
  box-sizing: border-box !important;
  /* Include padding in width */
  contain: layout style paint !important;
  /* Isolate from document flow */
}

.nav-item.position-relative,
.nav-item {
  position: relative !important;
  /* anchor for absolute dropdown */
  margin: 0 !important;
  /* No margin - tight spacing */
  padding: 0 !important;
  /* No padding */
  display: flex !important;
  /* Flex item in flex container */
  flex-direction: row !important;
  /* Horizontal */
  align-items: center !important;
  height: auto !important;
  /* Natural height - don't expand for mega menu */
  min-height: auto !important;
  overflow: visible !important;
  /* Allow mega menu to overflow */
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  width: auto !important;
}

.nav-item:hover .navigator-grid {
  display: block;
}

/* Navigation dropdown grid for all navigator buttons except Home */
.nav-btn:not(.home-btn) {
  position: relative !important;
  /* parent must be relative */
  z-index: 10 !important;
  /* above normal content */
  margin: 0 !important;
  /* No margin */
  padding: 4px 8px !important;
  /* Compact padding */
}

/* Show dropdown grid on hover - ABSOLUTE - NO DOCUMENT FLOW */
/* DISABLED: Let JavaScript handle hover to prevent all menus showing at once */
/* .nav-btn:not(.home-btn):hover .nav-item-grid,
.nav-item:hover .nav-item-grid {
    display: grid !important;
    position: absolute !important;
    margin: 0 !important;
    margin-top: 0 !important;
} */

/* Grid item styles */
.nav-item-grid .grid-item {
  text-align: center;
  font-size: 12px;
}

.navigator-grid {
  display: none !important;
  /* hide on page load */
  position: absolute !important;
  /* CRITICAL: Remove from document flow */
  z-index: 1000 !important;
  margin: 0 !important;
  /* No margin */
  margin-top: 0 !important;
  top: 100% !important;
  left: 0 !important;
}

.nav-item-grid .grid-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 5px;
}

footer {
  margin-top: auto;
  /* pushes footer down if content is less than viewport height */
}

/* ===============================
   NAV LINK HOVER + ACTIVE (RESTORED)
   - Hover turns blue
   - Current page stays blue
   =============================== */
#mainHeader .cell.center a.nav-link {
  color: #111827 !important;
  text-decoration: none !important;
}

#mainHeader .cell.center a.nav-link:visited {
  color: #111827 !important;
}

#mainHeader .cell.center a.nav-link:hover,
#mainHeader .cell.center a.nav-link:focus,
#mainHeader .cell.center a.nav-link:focus-visible {
  color: #007bff !important;
  text-decoration: none !important;
}

#mainHeader .cell.center .nav-item.active>a.nav-link,
#mainHeader .cell.center a.nav-link.active,
#mainHeader .cell.center a.nav-link[aria-current="page"] {
  color: #007bff !important;
}

/* ===============================
   NAV-BTN HOVER + ACTIVE (HEADER ROW 2 NAVIGATOR) - RESTORED
   =============================== */
#mainHeader a.nav-btn {
  color: #111827 !important;
  text-decoration: none !important;
}

#mainHeader a.nav-btn:visited {
  color: #111827 !important;
}

#mainHeader a.nav-btn:hover,
#mainHeader a.nav-btn:focus,
#mainHeader a.nav-btn:focus-visible {
  color: #007bff !important;
  text-decoration: none !important;
}

#mainHeader a.nav-btn.active,
#mainHeader a.nav-btn[aria-current="page"],
#mainHeader .nav-item.active>a.nav-btn {
  color: #007bff !important;
}

/* Header icon buttons (mobile header icons) */
#mainHeader .header-icon-btn:hover,
#mainHeader .header-icon-btn:focus,
#mainHeader .header-icon-btn:focus-visible {
  color: #007bff !important;
}

#mainHeader .header-icon-btn:hover i,
#mainHeader .header-icon-btn:focus i,
#mainHeader .header-icon-btn:focus-visible i {
  color: #007bff !important;
}
#wishlistModal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
}

#wishlistModal .modal-content {
    background: #fff;
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
    border-radius: 10px;
    position: relative;
}

#wishlistModal #closeWishlist {
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    font-size: 20px;
}
#notificationPopup {
  display: none;
  position: fixed;
  top: 75px;
  right: 20px;
  width: 320px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 2000;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

#notificationPopup h6 {
  margin: 0 0 10px 0;
  font-weight: 600;
}

#notificationPopup ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ==========================================================
   MASTER 3-COLUMN LAYOUT — SINGLE SOURCE OF TRUTH
   Structure: Left Ad Sidebar | Main Content | Right Ad Sidebar
   
   IMPORTANT: This file is the canonical layout authority.
   Do NOT override .main-layout-wrapper display or grid-template-columns
   in any page-specific <style> blocks.  All pages must respect this grid.
   ========================================================== */

/* Main Layout Wrapper - 3 Column Grid */
.main-layout-wrapper {
    display: grid !important;
    grid-template-columns: 220px 1fr 220px !important;
    gap: 20px;
    max-width: 1800px;
    /* Top inset from fixed header: body padding-top (adjustHeaderSpacer); do not stack margin here */
    margin: 0 auto !important;
    padding: 0 20px 20px 20px !important;
    min-height: 80vh;
    width: 100%;
    box-sizing: border-box;
}

/* DEFENSIVE: Ensure grid children stay in their columns */
.main-layout-wrapper > .sidebar-left,
.main-layout-wrapper > .sidebar-right,
.main-layout-wrapper > .content-area {
    float: none !important;
    clear: none !important;
    position: relative;
    box-sizing: border-box;
}

/* Sidebar Styles */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-left {
    grid-column: 1 !important;
}

.sidebar-right {
    grid-column: 3 !important;
}

.sidebar-content {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Content Area */
.content-area {
    grid-column: 2 !important;
    min-width: 0 !important;
    overflow: hidden;
    background: #fff;
    border-radius: 8px;
    box-sizing: border-box;
}

/* Prevent stray elements inside the grid wrapper from breaking columns */
.main-layout-wrapper > *:not(.sidebar-left):not(.sidebar-right):not(.content-area) {
    grid-column: 1 / -1;
}

/* Standardized 4-Card Grid Utility */
.card-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    margin-bottom: 40px;
}

@media (max-width: 1400px) {
    .card-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .card-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Ad Block Styles */
.ad-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    overflow: hidden;
}

.ad-block img {
    max-width: 100%;
    border-radius: 4px;
}

.ad-block h4 {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #333;
}

.ad-block p {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 15px;
}

.ad-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #adb5bd;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.btn-outline {
    border: 1px solid #667eea;
    color: #667eea;
    padding: 5px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-block;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: #667eea;
    color: #fff;
}

/* Specific Promo Styles */
.internal-promo .promo-links {
    list-style: none;
    padding: 0;
    text-align: left;
}

.internal-promo .promo-links li {
    margin-bottom: 8px;
}

.internal-promo .promo-links a {
    color: #555;
    text-decoration: none;
    font-size: 0.95em;
}

.internal-promo .promo-links a:hover {
    color: #667eea;
    padding-left: 5px;
    transition: 0.2s;
}

/* Charity Block Highlight */
.ad-block.charity-highlight {
    background: linear-gradient(135deg, #fff0f1 0%, #ffeef0 100%);
    border-color: #ffdce0;
}

.heart-icon {
    font-size: 24px;
    color: #ff4757;
    margin-bottom: 10px;
    animation: heartBeat 1.5s infinite;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    10% {
        transform: scale(1.1);
    }

    20% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}

.btn-charity {
    background: #ff4757;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.3);
}

.btn-charity:hover {
    background: #ff2e43;
    transform: translateY(-1px);
}


@media (max-width: 980px) {
    .main-layout-wrapper {
        margin-top: 0 !important;
    }
}

/* ==========================================================
   RESPONSIVE RULES
   ========================================================== */

/* Tablet: Squeeze sidebars */
@media (max-width: 1200px) {
    .main-layout-wrapper {
        grid-template-columns: 180px 1fr 180px !important;
    }
}

/* Mobile: Stack layout, hide sidebars */
@media (max-width: 768px) {
    .main-layout-wrapper {
        display: block !important;
        grid-template-columns: none !important;
        padding: 10px;
    }

    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    .content-area {
        width: 100% !important;
        grid-column: auto !important;
        overflow: visible;
    }
}


/* ===============================
   GLOBAL STANDARDIZATION: VERTICAL SPACING
   =============================== */

/* 1. Reset all internal margins of hero/banner units inside the layout wrapper */
.main-layout-wrapper .nikahfinder-hero,
.main-layout-wrapper .geno-hero,
.main-layout-wrapper .home-hero,
.main-layout-wrapper .pt-hero,
.main-layout-wrapper .global-category-bar,
.main-layout-wrapper .page-banner,
.main-layout-wrapper .hero-unit,
.main-layout-wrapper .hero-banner {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* 2. Header-to-content gap: adjustHeaderSpacer() body padding-top (+10px). Do not stack margin here. */
header ~ .main-layout-wrapper,
#mainHeader ~ .main-layout-wrapper,
.header-panel ~ .main-layout-wrapper {
    margin-top: 0 !important;
}

/* 3. Red Banner handling: 10px above and below according to user spec */
#redBannerWrapper {
    margin-top: 10px !important;
    margin-bottom: 10px !important;
}

#redBannerWrapper ~ .main-layout-wrapper {
    margin-top: 0 !important; /* Gap is handled by banner's margin-bottom */
}

/* ==========================================================
   UNIFIED 3-COLUMN HEADER ALIGNMENT (LEFT AD, MIDDLE CONTENT, RIGHT AD)
   Ensures both side ads and middle content all start at the exact same level
   about 8px (5-10px) below the fixed header across all pages throughout Deen-ul-Islam.
   ========================================================== */

:root {
    --iad-header-height: 85px;
    --iad-header-gap: 8px;
    --iad-content-start: calc(var(--iad-header-height) + var(--iad-header-gap));
}

html, body {
    margin: 0 !important;
}

/* 1. Body padding sets the top boundary for the entire layout */
html body,
html body.nikahfinder-site,
html body.muslimancestry-site {
    padding-top: var(--iad-content-start) !important;
}

/* 2. Main layout grid wrapper starts immediately with no extra top inset */
.main-layout-wrapper {
    display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr) 220px !important;
    gap: 20px !important;
    align-items: start !important; /* CRITICAL: Aligns all 3 columns to the exact same top edge */
    margin: 0 auto !important;
    padding-top: 0 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-bottom: 20px !important;
    box-sizing: border-box !important;
    position: relative !important;
}

/* 3. Both sidebars and content area start at top 0 within the grid */
.sidebar-left,
.sidebar-right,
.content-area,
.main-layout-wrapper > .sidebar-left,
.main-layout-wrapper > .sidebar-right,
.main-layout-wrapper > .content-area {
    margin-top: 0 !important;
    padding-top: 0 !important;
    top: 0 !important;
    position: relative !important;
    align-self: start !important;
    box-sizing: border-box !important;
}

/* 4. Sticky sidebar contents start at top 0 when un-scrolled, stick at header + gap when scrolled */
.sidebar-left .sidebar-content,
.sidebar-right .sidebar-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
    position: sticky !important;
    top: var(--iad-content-start) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

/* 5. First ad items on both sides start at margin 0 */
.sidebar-left .am-ad-stack,
.sidebar-right .am-ad-stack,
.sidebar-left .sidebar-content > *:first-child,
.sidebar-right .sidebar-content > *:first-child,
.sidebar-left .am-ad-item:first-child,
.sidebar-right .am-ad-item:first-child,
.sidebar-left .ad-banner:first-child,
.sidebar-right .ad-banner:first-child,
.sidebar-left .dynamic-ad-block:first-child,
.sidebar-right .dynamic-ad-block:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 6. Content area top element starts at top 0 with no extra top margin */
.content-area > *:first-child {
    margin-top: 0 !important;
}

.content-area .page-breadcrumbs,
.content-area .pt-page,
.content-area .pref-wrap,
.content-area .mat-page-header-wrap,
.content-area .global-category-bar,
.content-area .breadcrumb-nav {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 7. Accessibility skip link should not push layout content */
.skip-to-main {
    position: absolute !important;
    top: -100px !important;
    left: 0 !important;
    z-index: 10000 !important;
}
.skip-to-main:focus {
    top: 0 !important;
}

/* Defensive dropdown rules to prevent un-hovered menus spilling into content */
.learning-nav-item .islamic-learning-dropdown,
.islamic-learning-dropdown {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 999999 !important;
}
.learning-nav-item:hover .islamic-learning-dropdown,
.learning-nav-item.islamic-learning-open .islamic-learning-dropdown {
    display: block !important;
}

/* --- Header Auto-Enclosing & Navigator Positioning Fix --- */
#mainHeader,
#ufoHeaderContent,
#headerMiddlePanel,
.header-container {
    height: auto !important;
    min-height: 80px !important;
    max-height: none !important;
    overflow: visible !important;
}

#headerMiddlePanel {
    padding-bottom: 6px !important;
}

#navigator-container {
    height: auto !important;
    overflow: visible !important;
    padding: 2px 0 4px 0 !important;
    margin-bottom: 2px !important;
}

/* --- MuslimAncestry and NikahFinder Hover & Dropdown Styles --- */
.muslimancestry-nav-item,
.nikahfinder-nav-item {
    position: relative !important;
}

.islamic-muslimancestry-dropdown,
.islamic-nikahfinder-dropdown {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 220px !important;
    max-height: min(70vh, 420px) !important;
    overflow-y: auto !important;
    background: #fff !important;
    border: 1px solid rgba(0,0,0,0.12) !important;
    border-radius: 8px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
    padding: 6px 0 !important;
    z-index: 999999 !important;
}

/* Invisible hover bridge to eliminate hover flicker */
.islamic-muslimancestry-dropdown::before,
.islamic-nikahfinder-dropdown::before {
    content: "" !important;
    position: absolute !important;
    top: -20px !important;
    left: 0 !important;
    right: 0 !important;
    height: 20px !important;
    background: transparent !important;
}

/* Active hover selectors for CSS */
.muslimancestry-nav-item:hover .islamic-muslimancestry-dropdown,
.muslimancestry-nav-item.islamic-muslimancestry-open .islamic-muslimancestry-dropdown,
.nikahfinder-nav-item:hover .islamic-nikahfinder-dropdown,
.nikahfinder-nav-item.islamic-nikahfinder-open .islamic-nikahfinder-dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.islamic-muslimancestry-dropdown a,
.islamic-nikahfinder-dropdown a {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
    color: #0f172a !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

.islamic-muslimancestry-dropdown a:hover {
    background: #f1f5f9 !important;
    color: #0ea5e9 !important;
}

.islamic-nikahfinder-dropdown a:hover {
    background: #fdf2f8 !important;
    color: #e11d48 !important;
}

.islamic-muslimancestry-dropdown i,
.islamic-nikahfinder-dropdown i {
    width: 16px !important;
    text-align: center !important;
}

