/* ======================================================
   MEGA-MENU — Services Dropdown
   Shared across all pages
   ====================================================== */

/* ── Container for the dropdown li ── */
.header__nav-item--mega {
    position: relative;
}

/* ── Mega-menu panel ── */
.mega-menu {
    position: absolute;
    top: calc(100% + 18px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: min(920px, 92vw);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px 24px 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 1000;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

/* Custom scrollbar */
.mega-menu::-webkit-scrollbar { width: 5px; }
.mega-menu::-webkit-scrollbar-track { background: transparent; }
.mega-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }
.mega-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* Invisible bridge between nav link and dropdown (prevents gap hover loss) */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 0;
    right: 0;
    height: 24px;
}

/* Show on hover */
.header__nav-item--mega:hover .mega-menu,
.header__nav-item--mega:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* ── Grid layout: 4 columns for density ── */
.mega-menu__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px 10px;
}

/* ── Category heading ── */
.mega-menu__category {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 4px;
    margin-bottom: 1px;
}

.mega-menu__category:not(:first-child) {
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
}

.mega-menu__category-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mega-menu__category-dot--sf { background: #3b82f6; }
.mega-menu__category-dot--ag { background: #a78bfa; }
.mega-menu__category-dot--dt { background: #f97316; }
.mega-menu__category-dot--tb { background: #e97627; }
.mega-menu__category-dot--ms { background: #06b6d4; }
.mega-menu__category-dot--st { background: #22c55e; }

.mega-menu__category-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Individual service link ── */
.mega-menu__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.2;
    white-space: normal;
}

.mega-menu__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(2px);
}

.mega-menu__link-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.mega-menu__link:hover .mega-menu__link-icon {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.08);
}

.mega-menu__link-icon svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ── View All link ── */
.mega-menu__footer {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mega-menu__view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.mega-menu__view-all:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.mega-menu__view-all svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.mega-menu__view-all:hover svg {
    transform: translateX(3px);
}

/* ── Scrolled header adjustments ── */
.header.scrolled .mega-menu {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--color-border, #e2e8f0);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.header.scrolled .mega-menu__category-label {
    color: var(--color-text-secondary, #64748b);
}

.header.scrolled .mega-menu__link {
    color: var(--color-text-secondary, #475569);
}

.header.scrolled .mega-menu__link:hover {
    background: rgba(0, 102, 204, 0.05);
    color: var(--color-primary, #0066cc);
}

.header.scrolled .mega-menu__link-icon {
    background: rgba(0, 102, 204, 0.06);
}

.header.scrolled .mega-menu__link:hover .mega-menu__link-icon {
    background: rgba(0, 102, 204, 0.1);
}

.header.scrolled .mega-menu__view-all {
    background: rgba(0, 102, 204, 0.06);
    border-color: rgba(0, 102, 204, 0.15);
    color: var(--color-primary, #0066cc);
}

.header.scrolled .mega-menu__view-all:hover {
    background: rgba(0, 102, 204, 0.1);
}

.header.scrolled .mega-menu__footer {
    border-color: var(--color-border, #e2e8f0);
}

.header.scrolled .mega-menu__category:not(:first-child) {
    border-color: var(--color-border, #e2e8f0);
}

/* ── Responsive: hide mega-menu on mobile ── */
@media (max-width: 768px) {
    .mega-menu {
        display: none;
    }
}

/* ── Medium screens: 3 columns ── */
@media (min-width: 769px) and (max-width: 1024px) {
    .mega-menu {
        width: min(720px, 90vw);
    }
    .mega-menu__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}