/* ========================================
   NOVO MENU MOBILE - SEM GSAP
   Menu moderno com animações CSS puras
   ======================================== */

/* Prevenir scroll quando menu está aberto */
body.menu-open,
html.menu-open {
    overflow: hidden;
    height: 100%;
}

/* Mobile Toggle (Hamburger) - Animação moderna */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    cursor: pointer;
    z-index: 999999;
    position: relative;
    transition: transform 0.3s ease;
}

.mobile-toggle:hover {
    transform: scale(1.1);
}

.mobile-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 992px) {
    .mobile-toggle {
        display: flex;
    }
}

.mobile-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #f0f0f0;
    border-radius: 3px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

/* Animação do hamburger para X - APENAS quando active */
.mobile-toggle.active span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
    background-color: #38c172;
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-toggle.active span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
    background-color: #38c172;
}

/* Estado normal do hamburger - garantir que volta ao normal */
.mobile-toggle:not(.active) span:nth-child(1) {
    transform: translateY(0) rotate(0);
    background-color: #f0f0f0;
}

.mobile-toggle:not(.active) span:nth-child(2) {
    opacity: 1;
    transform: scaleX(1);
}

.mobile-toggle:not(.active) span:nth-child(3) {
    transform: translateY(0) rotate(0);
    background-color: #f0f0f0;
}

/* Efeito pulse no toggle quando ativo */
.mobile-toggle.active {
    animation: pulseGlow 1.5s ease-in-out;
}

/* Overlay escuro quando menu está aberto */
.main-nav::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    opacity: 0;
    transition: all 0.5s ease-in-out;
    z-index: -1;
}

@media (max-width: 992px) {
    .main-nav.active::before {
        /*background-color: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(5px);*/
        opacity: 1;
    }
}

/* Container do menu mobile */
@media (max-width: 992px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        background: #0521b0 !important; /* Azul claro uniforme */
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
        transform: translateX(100%);
        opacity: 0;
        transition: transform 0.5s ease-in-out,
                    opacity 0.5s ease-in-out;
        overflow-y: auto;
        z-index: 999998;
        display: none;
        flex-direction: column;
    }
    
    /* Animação ao abrir */
    .main-nav.active {
        transform: translateX(0);
        opacity: 1;
    }
    
    /* Garantir scrollbar customizada */
    .main-nav::-webkit-scrollbar {
        width: 6px;
    }
    
    .main-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .main-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .main-nav::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Mobile Nav Header */
@media (max-width: 992px) {
    .mobile-nav-header {
        padding: 30px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background: transparent !important; /* Fundo transparente */
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.4s ease 0.2s, 
                    transform 0.4s ease 0.2s;
    }
    
    .main-nav.active .mobile-nav-header {
        opacity: 1;
        transform: translateY(0);
    }
    
    .mobile-nav-header .mobile-logo {
        text-align: center;
    }
    
    .mobile-nav-header .mobile-logo img {
        max-width: 120px;
        height: auto;
        filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.2));
    }
}

/* Mobile Menu Footer - Botão Anuncie */
@media (max-width: 992px) {
    .mobile-menu-footer {
        padding: 30px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: auto;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, 
                    transform 0.4s ease;
    }
    
    .main-nav.active .mobile-menu-footer {
        opacity: 1;
        transform: translateY(0);
        transition-delay: 0.7s;
    }
    
    .btn-mobile-anuncie {
        display: block;
        text-align: center;
        padding: 15px 30px;
        font-size: 18px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 50px;
        color: #ffffff !important;
        text-decoration: none;
        box-shadow: 0 4px 20px rgba(0, 204, 102, 0.4);
        transition: all 0.3s ease;
    }
    
    .btn-mobile-anuncie:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 25px rgba(0, 204, 102, 0.6);
        color: #ffffff !important;
    }
}

/* Esconder botão mobile no desktop */
@media (min-width: 993px) {
    .mobile-menu-footer {
        display: none !important;
    }
}

/* Menu Items - Animação em cascata */
@media (max-width: 992px) {
    .main-nav ul {
        padding: 30px;
        flex: 1;
    }
    
    .main-nav ul li {
        opacity: 0;
        transform: translateX(30px);
        transition: opacity 0.4s ease, 
                    transform 0.4s ease;
        margin-bottom: 20px;
    }
    
    /* Animação em cascata quando menu abre */
    .main-nav.active ul li:nth-child(1) { transition-delay: 0.3s; }
    .main-nav.active ul li:nth-child(2) { transition-delay: 0.35s; }
    .main-nav.active ul li:nth-child(3) { transition-delay: 0.4s; }
    .main-nav.active ul li:nth-child(4) { transition-delay: 0.45s; }
    .main-nav.active ul li:nth-child(5) { transition-delay: 0.5s; }
    .main-nav.active ul li:nth-child(6) { transition-delay: 0.55s; }
    .main-nav.active ul li:nth-child(7) { transition-delay: 0.6s; }
    .main-nav.active ul li:nth-child(8) { transition-delay: 0.65s; }
    
    .main-nav.active ul li {
        opacity: 1;
        transform: translateX(0);
    }
    
    .main-nav ul li a {
        font-size: 18px;
        font-weight: 600;
        letter-spacing: 0.5px;
        padding: 12px 0;
        display: block;
        position: relative;
        transition: all 0.3s ease;
    }
    
    .main-nav ul li a:hover {
        color: #38c172;
        padding-left: 10px;
    }
}

/* Menu Trigger (setas) */
.menu-trigger::after {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.menu-trigger.active::after {
    transform: rotate(180deg);
}

/* Mobile Submenus - Animação suave */
@media (max-width: 992px) {
    .mobile-submenu {
        max-height: 0;
        overflow: hidden;
        padding-left: 20px;
        margin-top: 0;
        border-left: 3px solid transparent;
        transition: max-height 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
                    margin-top 0.3s ease,
                    border-color 0.3s ease;
    }
    
    .mobile-submenu.active {
        max-height: 500px;
        margin-top: 15px;
        border-left-color: #38c172;
    }
    
    .mobile-submenu a {
        display: block;
        padding: 10px 0;
        font-size: 16px;
        color: rgba(255, 255, 255, 0.85);
        text-transform: none;
        opacity: 0;
        transform: translateX(-10px);
        transition: all 0.3s ease;
    }
    
    .mobile-submenu.active a {
        opacity: 1;
        transform: translateX(0);
    }
    
    .mobile-submenu.active a:nth-child(1) { transition-delay: 0.05s; }
    .mobile-submenu.active a:nth-child(2) { transition-delay: 0.1s; }
    .mobile-submenu.active a:nth-child(3) { transition-delay: 0.15s; }
    .mobile-submenu.active a:nth-child(4) { transition-delay: 0.2s; }
    .mobile-submenu.active a:nth-child(5) { transition-delay: 0.25s; }
    
    .mobile-submenu a:hover {
        color: #38c172;
        padding-left: 12px;
    }
    
    .mobile-submenu a::after {
        display: none;
    }
}

/* Mega Mobile Menu */
@media (max-width: 992px) {
    .mega-mobile-menu {
        max-height: 0;
        overflow: hidden;
        margin-top: 0;
        transition: max-height 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                    margin-top 0.3s ease;
    }
    
    .mega-mobile-menu.active {
        max-height: 3000px;
        margin-top: 15px;
    }
    
    .mega-mobile-section {
        padding: 15px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-mobile-section:last-child {
        border-bottom: none;
    }
    
    /* Submenu aninhado (mega-mobile-submenu) */
    .mega-mobile-submenu {
        padding: 10px 0;
        margin-bottom: 5px;
    }
    
    .mega-mobile-content .mega-mobile-submenu {
        padding-left: 0;
        margin-bottom: 10px;
    }
    
    .mega-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 15px;
        background: transparent !important;
        border-radius: 0;
        cursor: pointer;
        transition: all 0.3s ease;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 16px;
        font-weight: 600;
        color: #f0f0f0;
    }
    
    .mega-mobile-toggle:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #38c172;
    }
    
    /* SVG do toggle */
    .mega-mobile-toggle svg {
        width: 12px;
        height: 12px;
        fill: #f0f0f0;
        transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        flex-shrink: 0;
    }
    
    .mega-mobile-toggle.active svg {
        transform: rotate(180deg);
    }
    
    .mega-mobile-toggle:hover svg {
        fill: #38c172;
    }
    
    /* Remover a seta ::after que estava duplicando */
    .mega-mobile-toggle::after {
        display: none !important;
    }
    
    .mega-mobile-content {
        max-height: 0;
        overflow: hidden;
        padding-left: 0;
        transition: max-height 0.4s ease-out,
                    margin-top 0.3s ease;
        display: block !important; /* Garantir display */
        visibility: visible !important; /* Garantir visibilidade */
    }
    
    .mega-mobile-content.active {
        max-height: 5000px !important;
        margin-top: 12px;
        display: block !important;
    }
    
    /* Subitens aninhados dentro de mega-mobile-content */
    .mega-mobile-content .mega-mobile-content {
        padding-left: 15px;
        max-height: 0;
    }
    
    .mega-mobile-content .mega-mobile-content.active {
        max-height: 1500px;
    }
    
    /* Links dentro do content */
    .mega-mobile-content > a {
        display: block;
        padding: 10px 15px;
        font-size: 15px;
        color: rgba(255, 255, 255, 0.85);
        text-transform: none;
        border-left: 2px solid transparent;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: all 0.3s ease;
        opacity: 0;
        transform: translateX(-10px);
    }
    
    .mega-mobile-content.active > a {
        opacity: 1;
        transform: translateX(0);
    }
    
    .mega-mobile-content.active > a:nth-child(1) { transition-delay: 0.05s; }
    .mega-mobile-content.active > a:nth-child(2) { transition-delay: 0.1s; }
    .mega-mobile-content.active > a:nth-child(3) { transition-delay: 0.15s; }
    .mega-mobile-content.active > a:nth-child(4) { transition-delay: 0.2s; }
    .mega-mobile-content.active > a:nth-child(5) { transition-delay: 0.25s; }
    .mega-mobile-content.active > a:nth-child(6) { transition-delay: 0.3s; }
    
    .mega-mobile-content a:hover {
        color: #38c172;
        border-left-color: #38c172;
        padding-left: 20px;
        background: rgba(255, 255, 255, 0.05) !important;
    }
    
    .mega-mobile-content a::after {
        display: none;
    }
}

/* Header Actions no mobile (esconder botão fixo) */
@media (max-width: 992px) {
    .header-actions {
        display: none !important;
    }
}

/* Melhorias visuais gerais */
@media (max-width: 992px) {
    /* Adicionar efeito de brilho nos links */
    .main-nav ul li a::before {
        content: '';
        position: absolute;
        left: 0;
        bottom: 8px;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, #38c172, #00cc66);
        transition: width 0.3s ease;
    }
    
    .main-nav ul li a:hover::before {
        width: 40px;
    }
    
    /* Efeito de ripple ao clicar */
    .menu-trigger,
    .mega-mobile-toggle {
        position: relative;
        overflow: hidden;
    }
    
    .menu-trigger::before,
    .mega-mobile-toggle::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(56, 193, 114, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s ease, height 0.6s ease;
    }
    
    .menu-trigger:active::before,
    .mega-mobile-toggle:active::before {
        width: 300px;
        height: 300px;
    }
}

/* Animações adicionais para melhor UX */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    60% {
        transform: translateX(-10px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutRight {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 193, 114, 0.7);
    }
    50% {
        box-shadow: 0 0 15px 5px rgba(56, 193, 114, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(56, 193, 114, 0);
    }
}

/* Garantir que desktop não seja afetado */
@media (min-width: 993px) {
    .mobile-nav-header {
        display: none !important;
    }
    
    .main-nav {
        transform: none !important;
        opacity: 1 !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        background: none !important;
        box-shadow: none !important;
    }
    
    .main-nav ul li {
        opacity: 1 !important;
        transform: none !important;
    }
    
    /* Correção de segurança para Desktop - Garantir visibilidade dos submenus */
    .main-nav ul li {
        overflow: visible !important;
    }
    
    .submenu.active, 
    .mega-menu.active,
    .mega-submenu-content.active,
    .mega-nested-content.active {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 999999 !important;
        pointer-events: auto !important;
    }
    
    /* Rotação da seta no desktop */
    .mega-submenu-header.active .mega-toggle svg,
    .mega-nested-header.active .mega-nested-toggle svg {
        transform: rotate(180deg);
        transition: transform 0.3s ease;
    }
}
