/* Advanced Mega Menu Styles */

/* Base Styles */
.adv-mega-menu {
    position: relative;
    width: 100%;
}

/* RTL Support */
[dir="rtl"] .adv-mega-menu__nav {
    direction: rtl;
}

[dir="rtl"] .adv-mega-menu__mobile-nav {
    direction: rtl;
}

.adv-mega-menu--sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: inherit;
}

.adv-mega-menu__nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.adv-mega-menu__item {
    position: relative;
}

/* New Badge Styles */
.adv-mega-menu__new-badge {
    position: absolute;
    bottom: 100%;
    inset-inline-end: 0;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.4);
    width: 57px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    color: #000;
    transform: translateY(-6px) translateX(17px);
    pointer-events: none;
    background: #fff;
    z-index: 10;
}

[dir="rtl"] .adv-mega-menu__new-badge {
    transform: translateY(-6px) translateX(-17px);
}

.adv-mega-menu__item > a {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Icon Position Styles */
.adv-mega-menu__link--icon-left {
    flex-direction: row;
    align-items: center;
}

.adv-mega-menu__link--icon-right {
    flex-direction: row-reverse;
    align-items: center;
}

.adv-mega-menu__link--icon-top {
    display: inline-block !important;
    text-align: center;
    vertical-align: top;
    line-height: 1.2;
}

.adv-mega-menu__link--icon-bottom {
    display: inline-block !important;
    text-align: center;
    vertical-align: top;
    line-height: 1.2;
}

.adv-mega-menu__link--icon-top > i,
.adv-mega-menu__link--icon-top > img {
    display: block !important;
    margin: 0 auto 6px auto !important;
}

.adv-mega-menu__link--icon-top > span {
    display: block !important;
}

.adv-mega-menu__link--icon-bottom > span {
    display: block !important;
    margin-bottom: 6px !important;
}

.adv-mega-menu__link--icon-bottom > i,
.adv-mega-menu__link--icon-bottom > img {
    display: block !important;
    margin: 0 auto !important;
}

/* Icon spacing for horizontal positions */
.adv-mega-menu__link--icon-left > i,
.adv-mega-menu__link--icon-left > img {
    margin-inline-end: 8px !important;
}

.adv-mega-menu__link--icon-right > i,
.adv-mega-menu__link--icon-right > img {
    margin-inline-start: 8px !important;
}

.adv-mega-menu__item.has-submenu > a::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-inline-start: 8px;
    font-size: 12px;
    transition: transform 0.3s ease;
}

[dir="rtl"] .adv-mega-menu__item.has-submenu > a::after {
    content: '\f077';
}

.adv-mega-menu__item.has-submenu:hover > a::after {
    transform: rotate(180deg);
}

/* Submenu Styles */
.adv-mega-menu__submenu {
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    min-width: 200px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px;
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    display: none;
    list-style: none;
    margin: 0;
}

.adv-mega-menu__submenu .adv-mega-menu__submenu {
    top: 0;
    inset-inline-start: 100%;
}

[dir="rtl"] .adv-mega-menu__submenu .adv-mega-menu__submenu {
    inset-inline-start: -100%;
}

.adv-mega-menu__submenu li {
    position: relative;
}

.adv-mega-menu__submenu a {
    display: block;
    padding: 8px 15px;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Mega Menu Styles */
.adv-mega-menu__megamenu {
    position: absolute;
    top: 100%;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 20px;
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    display: none;
}

/* Position Classes */
.adv-mega-menu__megamenu.position-left {
    inset-inline-start: 0;
}

.adv-mega-menu__megamenu.position-right {
    inset-inline-end: 0;
}

.adv-mega-menu__megamenu.position-center {
    left: 50%;
    transform: translateX(-50%);
}

[dir="rtl"] .adv-mega-menu__megamenu.position-center {
    right: 50%;
    left: auto;
    transform: translateX(50%);
}

.adv-mega-menu__megamenu.position-full {
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 100% !important;
}

/* Show on hover */
.adv-mega-menu__item:hover > .adv-mega-menu__submenu,
.adv-mega-menu__item:hover > .adv-mega-menu__megamenu {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* Animation Classes */
.adv-mega-menu__item:hover > .animation-none {
    transition: none;
}

.adv-mega-menu__item:hover > .animation-fade {
    animation: fadeIn 0.3s ease-out;
}

.adv-mega-menu__item:hover > .animation-slide {
    animation: slideDown 0.3s ease-out;
}

.adv-mega-menu__item:hover > .animation-scale {
    animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* RTL Animation Support */
[dir="rtl"] .adv-mega-menu__item:hover > .animation-slide {
    animation: slideDownRTL 0.3s ease-out;
}

@keyframes slideDownRTL {
    from {
        opacity: 0;
        transform: translateY(-10px) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Menu */
.adv-mega-menu__hamburger {
    padding: 10px;
    display: flex;
    align-items: center;
}

.adv-mega-menu__hamburger-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s ease;
}

.adv-mega-menu__hamburger-toggle:hover {
    opacity: 0.7;
}

.adv-mega-menu__mobile-menu {
    position: fixed;
    top: 0;
    inset-inline-end: -100%;
    height: 100%;
    width: 100%;
    transition: inset-inline-end 0.3s ease;
    z-index: 9999;
}

.adv-mega-menu__mobile-menu.active {
    inset-inline-end: 0;
}

.adv-mega-menu__mobile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.adv-mega-menu__mobile-menu.active .adv-mega-menu__mobile-overlay {
    opacity: 1;
    visibility: visible;
}

.adv-mega-menu__mobile-content {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    height: 100%;
    background: #fff;
    overflow-y: auto;
    z-index: 2;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.adv-mega-menu__mobile-menu.active .adv-mega-menu__mobile-content {
    transform: translateX(0);
}

[dir="rtl"] .adv-mega-menu__mobile-content {
    transform: translateX(-100%);
}

[dir="rtl"] .adv-mega-menu__mobile-menu.active .adv-mega-menu__mobile-content {
    transform: translateX(0);
}

.adv-mega-menu__mobile-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 3;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.adv-mega-menu__mobile-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.adv-mega-menu__mobile-nav {
    list-style: none;
    padding: 60px 20px 20px;
    margin: 0;
}

.adv-mega-menu__mobile-nav li {
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.adv-mega-menu__mobile-nav li:last-child {
    border-bottom: none;
}

.adv-mega-menu__mobile-nav a {
    display: flex;
    align-items: center;
    padding: 15px 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 5px;
}

.adv-mega-menu__mobile-nav a:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Mobile Icon Position Styles */
.adv-mega-menu__mobile-link--icon-left {
    flex-direction: row;
    align-items: center;
}

.adv-mega-menu__mobile-link--icon-right {
    flex-direction: row-reverse;
    align-items: center;
}

.adv-mega-menu__mobile-link--icon-top {
    display: block !important;
    text-align: center;
    line-height: 1.2;
}

.adv-mega-menu__mobile-link--icon-bottom {
    display: block !important;
    text-align: center;
    line-height: 1.2;
}

.adv-mega-menu__mobile-link--icon-top > i,
.adv-mega-menu__mobile-link--icon-top > img {
    display: block !important;
    margin: 0 auto 6px auto !important;
}

.adv-mega-menu__mobile-link--icon-top > span {
    display: block !important;
}

.adv-mega-menu__mobile-link--icon-bottom > span {
    display: block !important;
    margin-bottom: 6px !important;
}

.adv-mega-menu__mobile-link--icon-bottom > i,
.adv-mega-menu__mobile-link--icon-bottom > img {
    display: block !important;
    margin: 0 auto !important;
}

/* Mobile Icon spacing for horizontal positions */
.adv-mega-menu__mobile-link--icon-left > i,
.adv-mega-menu__mobile-link--icon-left > img {
    margin-inline-end: 8px !important;
}

.adv-mega-menu__mobile-link--icon-right > i,
.adv-mega-menu__mobile-link--icon-right > img {
    margin-inline-start: 8px !important;
}

/* RTL Mobile Icon Position Support */
[dir="rtl"] .adv-mega-menu__mobile-link--icon-left {
    flex-direction: row-reverse;
}

[dir="rtl"] .adv-mega-menu__mobile-link--icon-right {
    flex-direction: row;
}

[dir="rtl"] .adv-mega-menu__mobile-link--icon-left > i,
[dir="rtl"] .adv-mega-menu__mobile-link--icon-left > img {
    margin-inline-end: 0;
    margin-inline-start: 8px;
}

[dir="rtl"] .adv-mega-menu__mobile-link--icon-right > i,
[dir="rtl"] .adv-mega-menu__mobile-link--icon-right > img {
    margin-inline-start: 0;
    margin-inline-end: 8px;
}

.adv-mega-menu__mobile-nav ul {
    padding-inline-start: 20px;
    margin-top: 10px;
    list-style: none;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 5px;
    overflow: hidden;
}

.adv-mega-menu__mobile-nav .has-submenu > a {
    position: relative;
}

.adv-mega-menu__mobile-nav .has-submenu > a::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    inset-inline-end: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    font-size: 12px;
}

.adv-mega-menu__mobile-nav .has-submenu.open > a::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Elementor Editor Compatibility */
.elementor-editor-active .adv-mega-menu__submenu,
.elementor-editor-active .adv-mega-menu__megamenu {
    display: none !important;
}

/* RTL Responsive Support */
[dir="rtl"] .adv-mega-menu__item > a {
    flex-direction: row-reverse;
}

[dir="rtl"] .adv-mega-menu__item > a > i,
[dir="rtl"] .adv-mega-menu__item > a > img {
    margin-inline-end: 0;
    margin-inline-start: var(--icon-spacing, 8px);
}

/* RTL Icon Position Support */
[dir="rtl"] .adv-mega-menu__link--icon-left {
    flex-direction: row-reverse;
}

[dir="rtl"] .adv-mega-menu__link--icon-right {
    flex-direction: row;
}

[dir="rtl"] .adv-mega-menu__link--icon-left > i,
[dir="rtl"] .adv-mega-menu__link--icon-left > img {
    margin-inline-end: 0;
    margin-inline-start: 8px;
}

[dir="rtl"] .adv-mega-menu__link--icon-right > i,
[dir="rtl"] .adv-mega-menu__link--icon-right > img {
    margin-inline-start: 0;
    margin-inline-end: 8px;
}

/* Accessibility Improvements */
.adv-mega-menu__item > a:focus,
.adv-mega-menu__hamburger-toggle:focus,
.adv-mega-menu__mobile-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.adv-mega-menu__submenu a:focus {
    background: rgba(0, 115, 170, 0.1);
    outline: 1px solid #0073aa;
}

/* Performance Optimizations */
.adv-mega-menu__submenu,
.adv-mega-menu__megamenu {
    will-change: opacity, visibility;
}

.adv-mega-menu__mobile-content {
    will-change: transform;
}

/* Media Queries */
@media (min-width: 576px) {
    .d-sm-flex { display: flex !important; }
    .d-sm-none { display: none !important; }
}

@media (min-width: 768px) {
    .d-md-flex { display: flex !important; }
    .d-md-none { display: none !important; }
}

@media (min-width: 992px) {
    .d-lg-flex { display: flex !important; }
    .d-lg-none { display: none !important; }
}

@media (min-width: 1200px) {
    .d-xl-flex { display: flex !important; }
    .d-xl-none { display: none !important; }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .adv-mega-menu__item > a,
    .adv-mega-menu__submenu,
    .adv-mega-menu__megamenu,
    .adv-mega-menu__mobile-menu,
    .adv-mega-menu__mobile-content,
    .adv-mega-menu__hamburger-toggle,
    .adv-mega-menu__mobile-close {
        transition: none;
    }
    
    .adv-mega-menu__item:hover > .animation-fade,
    .adv-mega-menu__item:hover > .animation-slide,
    .adv-mega-menu__item:hover > .animation-scale {
        animation: none;
    }
}