/**
 * Estilos para Widgets Elementor Personalizados
 * 
 * Este arquivo contém todos os estilos CSS para os widgets
 * personalizados do Elementor do tema Eretz
 * 
 * @package Eretz
 * @subpackage Widgets_Elementor
 * @since 1.0.0
 */

/* ==========================================================================
   WIDGET: MENU PERSONALIZADO
   ========================================================================== */

/* Estilos base do menu */
.eretz-menu-wrapper {
    position: relative;
    display: block;
}

.eretz-menu {
    display: block;
}

.eretz-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.eretz-menu-horizontal ul {
    flex-direction: row;
}

.eretz-menu-vertical ul {
    flex-direction: column;
}

.eretz-menu .menu-item {
    position: relative;
}

.eretz-menu .menu-item a {
    display: block;
    text-decoration: none;
    padding: 10px 15px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ==========================================================================
   HAMBURGER MENU - MOBILE
   ========================================================================== */

/* Botão hambúrguer */
.hamburger-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    position: relative;
    z-index: 1001;
    transition: all 0.3s ease;
}

.hamburger-box {
    width: 24px;
    height: 18px;
    display: block;
    position: relative;
}

.hamburger-line {
    display: block;
    height: 2px;
    width: 100%;
    background-color: currentColor;
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.hamburger-line:nth-child(1) { top: 0; }
.hamburger-line:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger-line:nth-child(3) { bottom: 0; }

/* Animação do hambúrguer */
.hamburger-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg);
    top: 50%;
    margin-top: -1px;
}

.hamburger-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -1px;
}

/* Menu mobile */
.eretz-menu-wrapper.mobile-mode .hamburger-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1002;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 8px;
    width: 40px;
    height: 40px;
}

.eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 90vw;
    height: 100vh;
    background-color: #ffffff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding-top: 60px;
    visibility: hidden; /* Garantir que esteja invisível quando fechado */
}

/* Garantir que o menu só apareça quando explicitamente aberto */
.eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu.menu-open {
    transform: translateX(0);
    visibility: visible; /* Tornar visível quando aberto */
}

/* Garantir visibilidade básica do botão de fechar */
.eretz-menu-wrapper.mobile-mode .hamburger-toggle[aria-expanded="true"] {
    /* Os estilos agora vêm dos controles do Elementor */
}

/* Hover do botão de fechar */
.eretz-menu-wrapper.mobile-mode .hamburger-toggle[aria-expanded="true"]:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Responsividade básica para telas pequenas */
@media (max-width: 480px) {
    .eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu {
        width: 100%;
        max-width: 100%;
    }
}

/* Adicionar uma alternativa de posicionamento se necessário */
.eretz-menu-wrapper.has-hamburger {
    position: relative;
}

.eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu ul {
    flex-direction: column;
    padding: 20px;
}

.eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu .menu-item a {
    display: block;
    text-align: left;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

/* Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

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

/* Bloqueio de scroll */
body.menu-lock {
    overflow: hidden;
}

/* ==========================================================================
   ESTILOS AVANÇADOS PARA ITENS
   ========================================================================== */

/* Garantir que transformações funcionem bem */
.eretz-menu .menu-item a:hover {
    transform-origin: center;
    will-change: transform;
}

/* Melhorar o comportamento em mobile */
.eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu .menu-item a {
    display: block;
    text-align: left;
    align-items: flex-start;
    justify-content: flex-start;
}

/* Suporte para diferentes alturas */
.eretz-menu .menu-item a[style*="min-height"] {
    display: flex;
    align-items: center;
}

/* Melhorar compatibilidade com alinhamentos flexbox */
.eretz-menu ul {
    display: flex;
    flex-wrap: wrap;
}

/* Garantir que o background do menu funcione corretamente */
.eretz-menu-wrapper:not(.mobile-mode) .eretz-menu {
    overflow: hidden; /* Para bordas arredondadas funcionarem com background */
}

/* Alinhamentos especiais para space-between e space-around */
.eretz-menu ul[style*="justify-content: space-between"] .menu-item:first-child {
    margin-left: 0;
}

.eretz-menu ul[style*="justify-content: space-between"] .menu-item:last-child {
    margin-right: 0;
}

.eretz-menu ul[style*="justify-content: space-around"] .menu-item {
    margin-left: auto;
    margin-right: auto;
}

/* Suporte para stretch vertical */
.eretz-menu ul[style*="align-items: stretch"] .menu-item a {
    height: 100%;
    min-height: auto;
}

/* Melhorar alinhamento do texto justificado */
.eretz-menu .menu-item a[style*="text-align: justify"] {
    text-align-last: center;
}

/* Suporte para transformações de texto especiais */
.eretz-menu .menu-item a[style*="text-transform: full-width"] {
    font-variant: full-width;
}

/* Garantir que decorações de texto funcionem bem */
.eretz-menu .menu-item a[style*="text-decoration"] {
    text-decoration-skip-ink: auto;
    text-underline-offset: 2px;
}

/* ==========================================================================
   CLASSES CSS PERSONALIZADAS - EXEMPLOS
   ========================================================================== */

/* Classe: destacado */
.eretz-menu .menu-item.destacado a {
    font-weight: bold;
    color: #ff6b35 !important;
}

/* Classe: botao */
.eretz-menu .menu-item.botao a {
    background-color: #007cba;
    color: white !important;
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.eretz-menu .menu-item.botao a:hover {
    background-color: #005a87;
    transform: translateY(-2px);
}

/* Classe: especial */
.eretz-menu .menu-item.especial a {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Classe: outline */
.eretz-menu .menu-item.outline a {
    border: 2px solid #007cba;
    color: #007cba !important;
    background: transparent;
    border-radius: 5px;
}

.eretz-menu .menu-item.outline a:hover {
    background-color: #007cba;
    color: white !important;
}

/* ==========================================================================
   MELHORIAS DE PERFORMANCE E ACESSIBILIDADE
   ========================================================================== */

/* Melhorar legibilidade com espaçamentos personalizados */
.eretz-menu .menu-item a[style*="letter-spacing"] {
    font-feature-settings: "kern" 1;
}

.eretz-menu .menu-item a[style*="word-spacing"] {
    text-rendering: optimizeLegibility;
}

/* Respeitar preferências de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    .hamburger-line,
    .menu-overlay,
    .eretz-menu.mobile-menu,
    .eretz-menu.mobile-menu .menu-item a,
    .eretz-menu .menu-item a {
        transition: none !important;
        transform: none !important;
    }
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */

/* Tablets e dispositivos médios */
@media (max-width: 1024px) {
    .eretz-menu .menu-item a {
        padding: 8px 12px;
    }
}

/* Smartphones */
@media (max-width: 480px) {
    .eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu {
        width: 100%;
        max-width: 100%;
    }
    
    .eretz-menu-wrapper.mobile-mode .eretz-menu.mobile-menu .menu-item a {
        padding: 12px 15px;
        font-size: 16px;
    }
}
