/* ===============================
   HEADER LAYOUT & GENERAL STYLES
   =============================== */

/* Remove unwanted bottom spacing */
header {
  margin-bottom: 0;
  margin: 0;
  padding: 0;
  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: 20px → 10px to save 20px total height (116px → 96px) */
  padding: 10px 20px;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  gap: 15px;
}

.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 */
header,
.header-container {
  position: relative !important;
  overflow: visible !important;
  /* Allow mega menu to overflow */
  z-index: 10000 !important;
  /* Header above sidebar */
}

.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;
  min-height: 50px !important;
  /* Minimum height for visibility */
  max-height: none !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;
  min-height: 40px !important;
  /* Minimum height for visibility */
  max-height: none !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 */

/* ===== 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;
}

/* Main Layout Wrapper - 3 Column Grid */
.main-layout-wrapper {
    display: grid;
    /* Left Sidebar | Main Content | Right Sidebar */
    grid-template-columns: 220px 1fr 220px;
    gap: 20px;
    max-width: 1800px;
    /* Increased for better 4-card fit */
    margin: 0 auto;
    padding: 0 20px 20px 20px;
    min-height: 80vh;
}

/* 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;
    }
}

/* Sidebar Styles */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-content {
    position: sticky;
    top: 90px;
    /* Stick below header */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Content Area */
.content-area {
    min-width: 0;
    /* Prevents grid blowout */
    background: #fff;
    border-radius: 8px;
}

/* 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;
    /* slight movement */
    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);
}

/* Responsive Rules */

/* Tablet: Squeeze sidebars */
@media (max-width: 1200px) {
    .main-layout-wrapper {
        grid-template-columns: 180px 1fr 180px;
    }
}

/* Mobile/Small Tablet: Hide Sidebars (or move to bottom if requested later) */
@media (max-width: 900px) {
    .main-layout-wrapper {
        display: block;
        /* Stack everything */
        padding: 10px;
    }

    .sidebar-left,
    .sidebar-right {
        display: none;
        /* User requested removal on mobile to keep it clean */
    }

    .content-area {
        width: 100%;
    }
}

/* ===============================
   FIX GAP BETWEEN HEADER AND CONTENT & ENSURE MIDDLE ALIGNMENT
   =============================== */

/* Single source: gap from header bottom border line -> red banner (5px or 10px only) */
:root {
    --glrcf-header-banner-gap: 5px;
    --glrcf-banner-content-gap: 10px;
}

/* Vertical offset under the fixed header is owned by adjustHeaderSpacer() in header.php (inline + !important).
   Do NOT set body { padding-top } here -- it fights the spacer and causes double gaps or drift. */
html {
    scroll-padding-top: 0 !important;
}

body {
    margin-top: 0 !important;
}

/* Ensure header container does not add hidden spacing */
#mainHeader {
    margin-bottom: 0 !important;
}

.page-container {
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

/* All main wrappers start immediately below header/banner */
.page-container,
.main-content,
main,
.page-content,
#content,
.content,
.sales-container,
.browse-pages-container,
.trove-showcase-wrap,
.map-explorer-container {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Red Crisis Alert Banner */
#redBannerWrapper {
    margin-top: 5px !important;
    margin-bottom: var(--glrcf-banner-content-gap, 10px) !important;
}
#redCrisisBanner {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Main 3-column layout wrapper - centered in middle section */
.main-layout-wrapper {
    margin-top: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-top: 0 !important;
}

#redBannerWrapper ~ .main-layout-wrapper,
#redBannerWrapper + .main-layout-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Middle column + side ads: pin to top of layout row */
.main-layout-wrapper > .sidebar-left,
.main-layout-wrapper > .sidebar-right,
.main-layout-wrapper > .content-area {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.main-layout-wrapper .content-area > :first-child {
    margin-top: 0 !important;
}

.sidebar-left .sidebar-content,
.sidebar-right .sidebar-content,
.sidebar-left .am-ad-stack,
.sidebar-right .am-ad-stack,
.sidebar-left .ad-block,
.sidebar-right .ad-block {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Hero & Feature Sections on standalone pages - compact padding right below header */
.hero-section,
.services-hero,
.reports-hero,
.stories-hero,
.impact-hero,
.nikahfinder-hero,
.geno-hero,
.annual-reports,
.success-stories {
    margin-top: 0 !important;
    padding-top: 24px !important;
    padding-bottom: 24px !important;
}

/* Ensure containers in hero sections are horizontally centered in the middle section */
.hero-section .container,
.services-hero .hero-inner,
.reports-hero .container,
.stories-hero .container,
.impact-hero .container {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Eliminate gap from hidden or empty elements between header and content */
header ~ div[style*="display:none"],
header ~ div[style*="display: none"],
header ~ span[style*="display:none"],
header ~ div:empty:not(.ufo-control-panel):not(footer):not(.freebies-sidebar) {
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

