/* ==========================================================================
   SwiftCheck AI — Premium Responsive Features Mega Menu
   Inspired by Mitti Reference Layout & SwiftCheck Brand Identity
   ========================================================================== */

/* ---------- Core Trigger & Dropdown Wrapper ---------- */
.mega-dropdown {
  position: static;
}

.mega-trigger {
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: var(--bs-nav-link-font-size, 0.875rem);
  font-weight: var(--bs-nav-link-font-weight, 500);
  color: color-mix(in oklab, var(--surf-foam) 70%, transparent);
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: var(--bs-nav-link-padding-y, 0.5rem) var(--bs-nav-link-padding-x, 0);
}

.mega-trigger:hover,
.mega-trigger:focus-visible,
.mega-dropdown.is-open .mega-trigger {
  color: var(--surf-foam);
}

.mega-trigger-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.8;
}

.mega-dropdown.is-open .mega-trigger-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* ---------- Mega Menu Floating Container (Desktop & Tablet) ---------- */
@media (min-width: 992px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1030;
  }

  .site-header > .container {
    position: relative;
  }

  .mega-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: min(1200px, calc(100vw - 32px));
    max-height: calc(100vh - 5.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(175deg, #0d1a17 0%, #07100e 100%);
    border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: 18px;
    box-shadow: 
      0 28px 70px -15px rgba(0, 0, 0, 0.85),
      0 0 0 1px rgba(255, 255, 255, 0.06),
      0 0 45px -10px rgba(45, 212, 191, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: 
      opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0.25s ease;
    z-index: 1050;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  /* Safe hover transition bridge */
  .mega-menu::before {
    content: "";
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    height: 18px;
    display: block;
  }

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

/* Custom Scrollbar */
.mega-menu::-webkit-scrollbar {
  width: 6px;
}
.mega-menu::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}
.mega-menu::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.3);
  border-radius: 8px;
}
.mega-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.5);
}

/* Inner Padding */
.mega-menu-inner {
  padding: 1.5rem 1.75rem 1.35rem;
  color: #ffffff;
}

/* ---------- Menu Header Bar (SwiftCheck AI | FEATURES ^) ---------- */
.mega-menu-header {
  padding-bottom: 0.85rem;
}

.mega-menu-brand {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.mega-menu-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.3);
  color: #2dd4bf;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  line-height: 1;
}

.mega-menu-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, rgba(45, 212, 191, 0.15) 50%, rgba(255, 255, 255, 0.08) 100%);
  margin: 0.65rem 0 1.25rem 0;
}

/* ---------- Column Titles ---------- */
.mega-col-heading {
  color: #2dd4bf;
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  margin-top: 0;
}

/* ---------- Links List ---------- */
.mega-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mega-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  min-height: 44px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.925rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
}

.mega-link-item:hover,
.mega-link-item:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.mega-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #2dd4bf;
  opacity: 0.9;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mega-link-item:hover .mega-icon-box,
.mega-link-item:focus-visible .mega-icon-box {
  opacity: 1;
  transform: scale(1.1);
}

.mega-link-text {
  flex-grow: 1;
  line-height: 1.35;
}

.mega-item-arrow {
  color: #2dd4bf;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mega-link-item:hover .mega-item-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ---------- Featured Product Card ---------- */
.mega-featured-card {
  background: linear-gradient(145deg, rgba(18, 36, 32, 0.95) 0%, rgba(10, 22, 20, 0.95) 100%);
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.mega-featured-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.mega-featured-card:hover {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 14px 32px -8px rgba(0, 0, 0, 0.6), 0 0 25px -5px rgba(45, 212, 191, 0.2);
  transform: translateY(-1px);
}

.mega-featured-image-col {
  flex-shrink: 0;
  width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mega-featured-img {
  width: 100%;
  height: auto;
  max-height: 105px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.mega-featured-card:hover .mega-featured-img {
  transform: scale(1.04);
}

.mega-featured-body {
  flex: 1;
  min-width: 0;
}

.mega-featured-title {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.mega-featured-desc {
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.835rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.mega-featured-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #2dd4bf;
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, gap 0.2s ease;
}

.mega-featured-link:hover {
  color: #5eead4;
  gap: 0.55rem;
}

.mega-arrow {
  display: inline-block;
  font-size: 0.95rem;
  transition: transform 0.2s ease;
}

.mega-featured-link:hover .mega-arrow,
.mega-promo-card:hover .mega-promo-arrow,
.mega-btn-demo:hover .mega-arrow {
  transform: translate(2px, -2px);
}

/* ---------- Promotional Cards Grid ---------- */
.mega-promo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.15rem;
}

.mega-promo-card {
  display: block;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.95rem 1.15rem;
  text-decoration: none;
  transition: all 0.22s ease;
}

.mega-promo-card:hover,
.mega-promo-card:focus-visible {
  background: rgba(45, 212, 191, 0.06);
  border-color: rgba(45, 212, 191, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
}

.mega-promo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.mega-promo-title {
  font-family: var(--font-display, "Sora", sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.mega-promo-arrow {
  color: #2dd4bf;
  font-size: 1rem;
  font-weight: 600;
}

.mega-promo-sub {
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  line-height: 1.4;
}

/* ---------- Bottom Navigation Row ---------- */
.mega-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
}

.mega-bottom-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.mega-bottom-link {
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color 0.2s ease;
}

.mega-bottom-link:hover,
.mega-bottom-link:focus-visible {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mega-btn-demo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #2dd4bf;
  color: #071210;
  font-family: var(--font-sans, "Manrope", sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  text-decoration: none;
  line-height: 1.2;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mega-btn-demo:hover,
.mega-btn-demo:focus-visible {
  background: #5eead4;
  color: #040d0b;
  box-shadow: 0 4px 16px -2px rgba(45, 212, 191, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   BREAKPOINT 1: DESKTOP LAYOUT (1200px and Above)
   3 Columns: Workflows | AI & Reporting | Featured Product Card
   2 Promotional Cards side-by-side below
   Bottom navigation row
   ========================================================================== */
@media (min-width: 1200px) {
  .mega-menu-main {
    display: grid;
    grid-template-columns: 1fr 1fr 1.65fr;
    gap: 2rem;
    align-items: stretch;
  }

  .mega-group-workflows,
  .mega-group-ai {
    display: flex;
    flex-direction: column;
  }

  .mega-group-featured {
    display: flex;
    flex-direction: column;
  }

  .mega-group-featured .mega-platform-content {
    height: 100%;
    display: flex;
  }

  .mega-group-featured .mega-featured-card {
    height: 100%;
    flex-direction: row;
    align-items: center;
  }

  .mega-featured-image-col {
    width: 160px;
  }

  .mega-featured-img {
    max-height: 125px;
  }
}

/* ==========================================================================
   BREAKPOINT 2: TABLET LAYOUT (768px to 1199.98px)
   2-Column Grid: Workflows & AI side-by-side
   Featured Product Card in full-width row
   Promotional Cards side-by-side
   Bottom navigation row
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .mega-menu-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .mega-group-workflows {
    grid-column: 1;
  }

  .mega-group-ai {
    grid-column: 2;
  }

  .mega-group-featured {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
  }

  .mega-featured-card {
    width: 100%;
    flex-direction: row;
    gap: 1.5rem;
  }

  .mega-featured-image-col {
    width: 150px;
  }

  .mega-promo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .mega-menu-inner {
    padding: 1.25rem 1.35rem 1.15rem;
  }
}

/* For tablet portrait within collapsed navbar (if viewport is between 768px and 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .mega-menu {
    position: static;
    transform: none !important;
    width: 100% !important;
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none;
    background: rgba(10, 20, 18, 0.95);
    border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: 14px;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    display: none;
  }

  .mega-dropdown.is-open .mega-menu {
    display: block;
    animation: megaFadeDown 0.25s ease-out;
  }
}

/* ==========================================================================
   BREAKPOINT 3: MOBILE LAYOUT (Below 768px: 480px, 375px, 320px)
   Full responsive accordion navigation panel
   Expandable accordion groups (Inspection Workflows, AI & Reporting, Explore)
   Minimum 44px touch targets
   Stacked promotional cards
   Clear Book a Demo CTA
   Zero horizontal scrolling, naturally scrolling panel
   ========================================================================== */
@media (max-width: 767.98px) {
  .mega-dropdown {
    width: 100%;
  }

  .mega-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.65rem 0.5rem;
    font-size: 1rem;
    font-weight: 600;
  }

  .mega-menu {
    position: static;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none;
    background: #081210;
    border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: 12px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0;
    display: none;
  }

  .mega-dropdown.is-open .mega-menu {
    display: block;
    animation: megaFadeDown 0.25s ease-out;
  }

  .mega-menu-inner {
    padding: 1rem 0.85rem 1rem;
  }

  .mega-menu-header {
    padding-bottom: 0.5rem;
  }

  .mega-menu-brand {
    font-size: 1rem;
  }

  .mega-menu-divider {
    margin: 0.5rem 0 0.85rem;
  }

  .mega-menu-main {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  /* Accordion Groups */
  .mega-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease;
  }

  .mega-group.is-expanded {
    border-color: rgba(45, 212, 191, 0.3);
    background: rgba(45, 212, 191, 0.02);
  }

  .mega-accordion-toggle {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.85rem;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: var(--font-display, "Sora", sans-serif);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mega-acc-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2dd4bf;
    box-shadow: 0 0 8px rgba(45, 212, 191, 0.6);
  }

  .mega-acc-chevron {
    color: #2dd4bf;
    transition: transform 0.25s ease;
    flex-shrink: 0;
  }

  .mega-group.is-expanded .mega-acc-chevron {
    transform: rotate(180deg);
  }

  /* Accordion Collapse Content */
  .mega-group-content {
    display: none;
    padding: 0 0.5rem 0.75rem;
  }

  .mega-group.is-expanded .mega-group-content {
    display: block;
    animation: megaAccordionSlide 0.2s ease-out;
  }

  /* Mobile Links List */
  .mega-links-list {
    gap: 0.35rem;
  }

  .mega-link-item {
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
  }

  .mega-link-item:active {
    background: rgba(45, 212, 191, 0.1);
  }

  /* Mobile Featured Product Card */
  .mega-featured-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.85rem;
    border-radius: 10px;
  }

  .mega-featured-image-col {
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
  }

  .mega-featured-img {
    max-height: 90px;
  }

  .mega-featured-title {
    font-size: 0.95rem;
  }

  .mega-featured-desc {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }

  /* Mobile Promo Cards */
  .mega-promo-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-top: 0.85rem;
  }

  .mega-promo-card {
    min-height: 44px;
    padding: 0.75rem 0.85rem;
  }

  .mega-promo-title {
    font-size: 0.875rem;
  }

  /* Mobile Bottom Row */
  .mega-bottom-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-top: 0.75rem;
  }

  .mega-bottom-links {
    justify-content: center;
    gap: 1rem;
  }

  .mega-bottom-link {
    font-size: 0.8125rem;
    padding: 0.35rem;
  }

  .mega-btn-demo {
    min-height: 44px;
    justify-content: center;
    width: 100%;
    font-size: 0.875rem;
  }
}

/* Animations */
@keyframes megaFadeDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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