/* ═══════════════════════════════════════════════════════════════════════
   CORPPOLICY HEADER — MEGA MENU CSS (CLEAN)
   ─────────────────────────────────────────────────────────────────────
   Services mega menu — 4-column grid with categories + badges.
   Companion to: header-nav.css, header-main.css, header-logo.css
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   WRAPPER + TRIGGER
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.mega-menu-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
  transition: all 0.3s ease;
  user-select: none;
}

.mega-menu-trigger:hover {
  color: #4f46e5;
  transform: translateY(-1px);
}

.mega-menu-trigger i:first-child {
  font-size: 13px;
}

.mega-menu-trigger i:last-child {
  font-size: 10px;
  margin-left: 2px;
  transition: transform 0.25s ease;
}

.mega-menu-trigger:hover i:last-child,
.mega-menu-wrapper.open .mega-menu-trigger i:last-child {
  transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════════════════════════════
   DROPDOWN CONTAINER
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-dropdown {
  position: absolute;
  top: 100%;
  margin-top: 0;  /* No gap — bridge handles it */
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: 900px;
  max-width: 95vw;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 60px -12px rgba(15, 23, 42, 0.18),
              0 4px 14px -4px rgba(15, 23, 42, 0.08);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1100;
}

.mega-menu-wrapper:hover .mega-menu-dropdown,
.mega-menu-wrapper.open .mega-menu-dropdown,
.mega-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mega-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  pointer-events: auto;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 2px 0 0 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   4-COLUMN GRID
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.mega-menu-column h4 {
  font-size: 11px;
  font-weight: 700;
  color: #4f46e5;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mega-menu-column h4 i {
  font-size: 12px;
  color: #4f46e5;
}

.mega-menu-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-menu-column ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #475569;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.mega-menu-column ul li a:hover {
  background: rgba(79, 70, 229, 0.06);
  color: #4f46e5;
  transform: translateX(3px);
}

.mega-menu-column ul li a i {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg,
              rgba(79, 70, 229, 0.1),
              rgba(124, 58, 237, 0.1));
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}

.mega-menu-column ul li a:hover i {
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════════
   BADGES (Popular / New / Trending)
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.mega-menu-badges .badge-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.mega-menu-badges .badge-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mega-menu-badges .badge-item .dot.popular { background: #f59e0b; }
.mega-menu-badges .badge-item .dot.new { background: #22c55e; }
.mega-menu-badges .badge-item .dot.trending { background: #4f46e5; }

/* ═══════════════════════════════════════════════════════════════════════
   FOOTER (AI suggestion + quick actions)
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.mega-menu-footer .ai-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg,
              rgba(79, 70, 229, 0.06),
              rgba(124, 58, 237, 0.06));
  border-radius: 10px;
  flex: 1;
  min-width: 280px;
}

.mega-menu-footer .ai-suggestion i {
  font-size: 18px;
  color: #4f46e5;
  flex-shrink: 0;
}

.mega-menu-footer .ai-suggestion .text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.mega-menu-footer .ai-suggestion .text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
}

.mega-menu-footer .ai-suggestion .text span {
  font-size: 11.5px;
  color: #64748b;
}

.mega-menu-footer .quick-actions {
  display: flex;
  gap: 8px;
}

.mega-menu-footer .quick-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.06);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mega-menu-footer .quick-actions a:hover {
  background: #4f46e5;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE ACCORDION
   ═══════════════════════════════════════════════════════════════════════ */

.mega-menu-mobile {
  display: none;
}

.mega-menu-mobile .accordion-item {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.mega-menu-mobile .accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s ease;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.mega-menu-mobile .accordion-header:hover {
  background: rgba(79, 70, 229, 0.04);
}

.mega-menu-mobile .accordion-header i {
  font-size: 12px;
  transition: transform 0.25s ease;
}

.mega-menu-mobile .accordion-header.active i {
  transform: rotate(180deg);
}

.mega-menu-mobile .accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.mega-menu-mobile .accordion-body.open {
  max-height: 800px;
}

.mega-menu-mobile .accordion-body ul {
  list-style: none;
  padding: 0 0 8px 12px;
  margin: 0;
}

.mega-menu-mobile .accordion-body ul li {
  padding: 6px 0;
}

.mega-menu-mobile .accordion-body ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #475569;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.mega-menu-mobile .accordion-body ul li a:hover {
  background: rgba(79, 70, 229, 0.06);
  color: #4f46e5;
}

.mega-menu-mobile .accordion-body ul li a i {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg,
              rgba(79, 70, 229, 0.1),
              rgba(124, 58, 237, 0.1));
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════════
   DARK MODE — Mega Menu
   ═══════════════════════════════════════════════════════════════════════ */

body.dark-mode .mega-menu-trigger {
  color: rgba(255, 255, 255, 0.75);
}

body.dark-mode .mega-menu-trigger:hover {
  color: #a5b4fc;
}

body.dark-mode .mega-menu-dropdown {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.6);
}

body.dark-mode .mega-menu-dropdown::before {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .mega-menu-column h4 {
  color: #a5b4fc;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .mega-menu-column h4 i {
  color: #a5b4fc;
}

body.dark-mode .mega-menu-column ul li a {
  color: #cbd5e1;
}

body.dark-mode .mega-menu-column ul li a:hover {
  background: rgba(165, 180, 252, 0.08);
  color: #a5b4fc;
}

body.dark-mode .mega-menu-column ul li a i {
  background: linear-gradient(135deg,
              rgba(165, 180, 252, 0.15),
              rgba(196, 181, 253, 0.15));
  color: #a5b4fc;
}

body.dark-mode .mega-menu-badges {
  border-top-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .mega-menu-badges .badge-item {
  color: #94a3b8;
}

body.dark-mode .mega-menu-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .mega-menu-footer .ai-suggestion {
  background: linear-gradient(135deg,
              rgba(165, 180, 252, 0.08),
              rgba(196, 181, 253, 0.08));
}

body.dark-mode .mega-menu-footer .ai-suggestion .text strong {
  color: #f1f5f9;
}

body.dark-mode .mega-menu-footer .ai-suggestion .text span {
  color: #94a3b8;
}

body.dark-mode .mega-menu-footer .quick-actions a {
  background: rgba(165, 180, 252, 0.1);
  color: #a5b4fc;
}

body.dark-mode .mega-menu-footer .quick-actions a:hover {
  background: #4f46e5;
  color: #fff;
}

body.dark-mode .mega-menu-mobile .accordion-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .mega-menu-mobile .accordion-header {
  color: #e2e8f0;
}

body.dark-mode .mega-menu-mobile .accordion-header:hover {
  background: rgba(165, 180, 252, 0.06);
}

body.dark-mode .mega-menu-mobile .accordion-body ul li a {
  color: #cbd5e1;
}

body.dark-mode .mega-menu-mobile .accordion-body ul li a:hover {
  background: rgba(165, 180, 252, 0.08);
  color: #a5b4fc;
}

body.dark-mode .mega-menu-mobile .accordion-body ul li a i {
  background: linear-gradient(135deg,
              rgba(165, 180, 252, 0.15),
              rgba(196, 181, 253, 0.15));
  color: #a5b4fc;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile / Tablet
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .mega-menu-dropdown {
    width: 95vw;
    padding: 16px;
  }

  .mega-menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .mega-menu-grid {
    grid-template-columns: 1fr;
  }

  .mega-menu-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .mega-menu-footer .ai-suggestion {
    min-width: 0;
  }

  .mega-menu-footer .quick-actions {
    justify-content: center;
  }
}
