/* ===========================
   Mega Menu
   =========================== */

/* Wrapper on <li> that has a mega menu */
.has-megamenu {
    position: static;
}

.has-megamenu > .nav-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.has-megamenu > .nav-item::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px;
    transition: transform 0.3s ease;
}

.has-megamenu.mega-open > .nav-item {
    color: var(--color-primary-light);
}

.has-megamenu.mega-open > .nav-item::after {
    transform: rotate(-135deg);
    margin-top: 3px;
}

/* Toggle button — hidden on desktop, visible on mobile */
.mega-toggle {
    display: none;
}

/* ===========================
   Mega Menu Panel
   =========================== */
.mega-menu {
    position: absolute;
    /* 48px wrapper padding-top + 100px glass height + 8px gap */
    top: calc(48px + 100px + 8px);
    left: var(--content-padding);
    right: var(--content-padding);
    background: var(--color-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-s) !important;
    padding: 40px 60px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 100;
}

.mega-menu.mega-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ===========================
   Mega Menu Grid — 3 columns
   =========================== */
.mega-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ===========================
   Mega Menu Item
   =========================== */
.mega-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.mega-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Thumbnail — services use rectangular photos */
.mega-item-thumb {
    flex-shrink: 0;
    width: 104px;
    height: 64px;
    border-radius: 3px;
    object-fit: cover;
}

/* Icon — products use square animated icons */
.mega-item-icon {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.mega-item-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.mega-item-title {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-white);
    margin: 0;
    white-space: nowrap;
}

.mega-item-desc {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    max-width: 231px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===========================
   Mega Menu Footer — View All
   =========================== */
.mega-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--color-glass-border);
    margin-top: 16px;
}


.rotate-180 {
    transform: rotate(180deg);
}

.mega-view-all {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary-light);
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.mega-view-all:hover {
    opacity: 0.8;
}

/* ===========================
   Responsive — Tablet
   =========================== */
@media (max-width: 1200px) {
    .mega-menu {
        top: calc(22px + 100px + 8px);
        padding: 30px 40px;
    }

    .mega-item-thumb {
        width: 80px;
        height: 50px;
    }

    .mega-item-icon {
        width: 50px;
        height: 50px;
    }

    .mega-item-desc {
        font-size: 12px;
        max-width: 180px;
    }
}

/* ===========================
   Responsive — Mobile
   =========================== */
@media (max-width: 991px) {
    .has-megamenu {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    .has-megamenu > .nav-item {
        display: inline-flex;
    }

    .has-megamenu > .nav-item::after {
        display: none;
    }

    .mega-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .mega-toggle::after {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        border-right: 2px solid var(--color-white);
        border-bottom: 2px solid var(--color-white);
        transform: rotate(45deg);
        transition: transform 0.3s ease;
    }

    .has-megamenu.mega-open > .mega-toggle::after {
        transform: rotate(-135deg);
    }

    .mega-menu {
        position: static;
        width: 100%;
        background: rgba(255, 255, 255, 0.05);
        border: none;
        border-radius: var(--radius-xs);
        padding: 0 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.3s ease;
    }

    .mega-menu.mega-visible {
        max-height: 800px;
        padding: 12px 8px;
        overflow-y: auto;
    }

    .mega-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .mega-item {
        position: relative;
        padding: 10px 16px;
        border-radius: 0;
        overflow: hidden;
    }

    .mega-item::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 10px;
        right: 10px;
        height: 1px;
        background: var(--color-glass-border);
    }

    .mega-item:last-child::after {
        display: none;
    }

    .mega-item-thumb {
        width: 60px;
        height: 40px;
    }

    .mega-item-icon {
        width: 40px;
        height: 40px;
    }

    .mega-item-desc {
        display: none;
    }

    .mega-footer {
        display: none;
    }

    .mega-item-title {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mega-menu,
    .mega-item,
    .has-megamenu > .nav-item::after {
        transition: none;
    }
}
