/* =========================================================
   SyntesAI — Products Mega Menu
   Appears inside any primary-menu <li> that has the CSS class
   "has-mega-menu". The .sa-header acts as the positioning context.
   ========================================================= */

/* The <li> takes position: static so the mega menu can stretch to the header width */
.sa-header__menu>li.has-mega-menu {
    position: static;
}

/* Hide any WP-generated sub-menu children on mega items (but keep our mobile nav) */
.sa-header__menu>li.has-mega-menu>.sub-menu:not(.sa-mm-mobile) {
    display: none !important;
}

/* Mobile simple nav — hidden on desktop */
@media (min-width: 992px) {
    .sa-mm-mobile {
        display: none !important;
    }
}

/* ---------- Mega Container ---------- */
.sa-mega {
    position: absolute;
    top: 85%;
    left: 50%;
    transform: translate(-50%, 8px);
    width: min(1280px, calc(100vw - 32px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(10, 20, 40, 0.18), 0 0 0 1px rgba(10, 20, 40, 0.04);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    overflow: hidden;
    max-height: calc(100vh - 110px);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sa-header__menu>li.has-mega-menu:hover>.sa-mega,
.sa-header__menu>li.has-mega-menu:focus-within>.sa-mega,
.sa-header__menu>li.has-mega-menu.is-open>.sa-mega {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

/* Rotate the caret on the Products link when mega menu is visible */
.sa-header__menu>li.has-mega-menu:hover>a::after,
.sa-header__menu>li.has-mega-menu:focus-within>a::after,
.sa-header__menu>li.has-mega-menu.is-open>a::after {
    transform: rotate(-135deg) translateY(-2px);
}

.sa-mega__inner {
    display: grid;
    grid-template-columns: 360px 1fr;
    flex: 1;
    /* fill the flex column in .sa-mega */
    min-height: 0;
    /* allow grid to shrink below content size */
    overflow: hidden;
}

/* ---------- Left Panel ---------- */
.sa-mega__left {
    position: relative;
    padding: 36px 32px 32px;
    color: #fff;
    background:
        radial-gradient(120% 100% at 0% 0%, rgba(255, 255, 255, 0.12) 0%, transparent 55%),
        linear-gradient(150deg, #1554d1 0%, #2f6bff 45%, #6f57ff 100%);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* allow panel to shrink so scrollbar can appear */
}

/* Thin scrollbar — left panel (white on dark bg) */
.sa-mega__left::-webkit-scrollbar {
    width: 4px;
}

.sa-mega__left::-webkit-scrollbar-track {
    background: transparent;
}

.sa-mega__left::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

.sa-mega__left::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

.sa-mega__left-glow {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 107, 138, 0.55) 0%, rgba(138, 92, 255, 0.25) 50%, transparent 70%);
    filter: blur(10px);
    pointer-events: none;
}

.sa-mega__left-title {
    position: relative;
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.sa-mega__left-desc {
    position: relative;
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.88);
}

.sa-mega__left-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 3px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    transition: gap .2s ease, border-color .2s ease;
}

.sa-mega__left-cta:hover {
    gap: 10px;
    border-color: #fff;
    color: #fff;
}

.sa-mega__left-list {
    position: relative;
    margin: 28px 0 0;
    padding: 24px 0 0;
    list-style: none;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.sa-mega__left-list li {
    margin: 0;
}

.sa-mega__left-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s ease, transform .15s ease;
}

.sa-mega__left-list a svg {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s ease, transform .2s ease;
}

.sa-mega__left-list a:hover {
    color: #fff;
    transform: translateX(2px);
}

.sa-mega__left-list a:hover svg {
    opacity: 1;
    transform: translateX(0);
}

/* ---------- Right Panel ---------- */
.sa-mega__right {
    padding: 36px 36px 32px;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* allow panel to shrink so scrollbar can appear */
}

/* Thin scrollbar — right panel */
.sa-mega__right::-webkit-scrollbar {
    width: 4px;
}

.sa-mega__right::-webkit-scrollbar-track {
    background: transparent;
}

.sa-mega__right::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}

.sa-mega__right::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.35);
}

.sa-mega__right-label {
    margin: 0 0 22px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b7280;
}

.sa-mega__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
}

/* Card (link or div) */
.sa-mega__card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid transparent;
    color: inherit;
    text-decoration: none;
    transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
    position: relative;
}

a.sa-mega__card:hover {
    border-color: rgba(47, 107, 255, 0.18);
    background: #f7f9ff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(47, 107, 255, 0.08);
}

.sa-mega__card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(47, 107, 255, 0.12), rgba(138, 92, 255, 0.14));
    color: #2f6bff;
}

.sa-mega__card-icon img {
    max-width: 22px;
    max-height: 22px;
    display: block;
}

.sa-mega__card-icon--default {
    background: linear-gradient(135deg, #2f6bff 0%, #8a5cff 100%);
    color: #fff;
}

.sa-mega__card-body {
    min-width: 0;
}

.sa-mega__card-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: #0b1f3a;
    line-height: 1.3;
}

.sa-mega__card-desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: #475569;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
    .sa-mega__inner {
        grid-template-columns: 300px 1fr;
    }

    .sa-mega__left,
    .sa-mega__right {
        padding-left: 28px;
        padding-right: 28px;
    }

    .sa-mega__grid {
        gap: 14px 20px;
    }
}

/* Mobile: hide mega panel completely, show simple sub-menu instead */
@media (max-width: 991.98px) {
    .sa-header__menu>li.has-mega-menu {
        position: relative;
    }

    /* Kill the full mega panel — .sa-mm-mobile takes over */
    .sa-mega {
        display: none !important;
    }

    /* .sa-mm-mobile is a .sub-menu so header.css already handles:
       - display:none by default
       - display:block when parent li has .is-open (toggled by header.js) */
    .sa-mm-mobile__overview>a {
        font-weight: 600;
        opacity: 1 !important;
    }
}