/* /menu/menu.css */

/* --- Barra Principal (Navbar) --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: rgba(255, 255, 255, 0);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 1002;
    box-sizing: border-box;
    /* overflow: hidden; */ /* ¡ASEGÚRATE QUE ESTO NO ESTÉ ACTIVO! */
}
.navbar.scrolled {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.navbar-logo {
    flex-shrink: 0;
}
.navbar-logo img {
    height: 32px;
    display: block;
}
.navbar-right-container {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 8px;
    overflow: visible; /* Asegurar que no corte dropdowns */
}

/* --- Menú de Escritorio --- */
.nav-links-desktop {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 25px;
}
.nav-links-desktop li a {
    text-decoration: none;
    color: #333;
    font-weight: 300;
    text-transform: uppercase;
    font-family: 'Ubuntu', sans-serif;
    font-size: 14px;
    transition: color 0.3s ease;
}
@media (min-width: 1024px) {
    .nav-links-desktop li a {
        font-weight: bold;
    }
}
.nav-links-desktop a:hover {
    color: #ffd500;
}

/* --- Dropdown Escritorio --- */
.nav-links-desktop .dropdown {
    position: relative;
}

/* Estilos generales del submenu */
.dropdown .submenu {
    display: none; /* Oculto por defecto, JS lo controla */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 10px 0;
    list-style: none;
    z-index: 1003;
}

/* Ancho específico para cada submenu usando ID */
#submenu-cases { min-width: 200px; }
#submenu-projects { min-width: 220px; }


/* Regla :hover eliminada para control JS */
/* .nav-links-desktop .dropdown:hover > .submenu { display: block; } */

/* NUEVA CLASE: Para mostrar el submenu con JavaScript */
.dropdown .submenu.submenu-active {
    display: block;
}

/* Opcional: Estilo visual para el enlace cuando el dropdown está activo */
.nav-links-desktop .dropdown > a[aria-expanded="true"] {
    color: #ffd500;
}
/* Opcional: Rotar la flecha cuando está activo */
.nav-links-desktop .dropdown > a[aria-expanded="true"]::after {
    transform: rotate(180deg);
    display: inline-block;
}

/* Estilos de los items del submenu */
.submenu li { margin: 0; }
.submenu li a {
    display: block;
    padding: 10px 20px;
    color: #333;
    font-weight: normal;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.submenu li a:hover { background-color: #f4f4f4; color: #000; }

/* Estilo para el enlace activo (la página actual) */
.nav-links-desktop > li > a.active,
.submenu li a.active {
    color: #ffd500;
    font-weight: bold;
}


/* Flecha desplegable */
.nav-links-desktop .dropdown > a::after { content: ' ▼'; font-size: 0.6em; vertical-align: middle; margin-left: 5px; transition: transform 0.2s ease; /* Añadida transición */}

/* --- Selector Idioma Escritorio (Texto) --- */
.language-selector { display: block; }
.language-selector a { display: inline-block; padding: 8px 14px; margin: 0 4px; border-radius: 8px; text-decoration: none; font-weight: bold; color: #333; background-color: transparent; transition: all 0.3s ease; }
.language-selector a.lang-active { background-color: #Ffd500; color: #000000; }
.language-selector a:not(.lang-active):hover { color: #Ffd500; }

/* --- Icono Hamburguesa (Móvil) --- */
.menu-toggle { display: none; flex-direction: column; justify-content: space-between; height: 20px; width: 30px; cursor: pointer; z-index: 1008; flex-shrink: 0; }
.menu-toggle .bar { width: 100%; height: 3px; background-color: #ffd500; transition: background-color 0.3s ease; }

/* --- Menú Overlay Móvil --- */
.nav-mobile { position: fixed; top: 0; right: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); z-index: 9999; display: none; flex-direction: column; justify-content: center; align-items: center; transform: translateX(100%); transition: transform 0.3s ease-in-out; }
.nav-mobile.active { display: flex !important; transform: translateX(0); }
.nav-mobile ul { list-style: none; padding: 0; text-align: center; width: 100%;}

.nav-mobile li {
    margin: 0;
    width: 100%;
}

.nav-mobile a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: normal;
    text-transform: uppercase;
    font-family: 'Ubuntu', sans-serif;
    transition: color 0.3s ease, background-color 0.3s ease;
    display: block;
    width: 100%;
    padding: 15px 0;
    box-sizing: border-box;
}

.nav-mobile a:hover {
    color: #ffd500;
	font-weight: bold;
}

/* Estilo para items de submenú en móvil */
.nav-mobile a.mobile-submenu-item {
    padding-left: 15%; /* Ajusta este valor para el sangrado deseado */
    font-size: 1.3rem;
    text-align: left;
}

/* Botón 'X' para cerrar menú móvil */
div.nav-mobile a.close-menu-mobile {
    position: absolute;
    top: 20px;
    right: 25px;
    left: auto !important;
    font-size: 2.5rem;
    font-weight: bold;
    color: white !important;
    text-decoration: none;
    transition: color 0.3s ease;
    z-index: 10000;
    opacity: 1;
    display: inline-block !important;
    width: auto !important;
    padding: 0 !important;
}

div.nav-mobile a.close-menu-mobile:hover {
    color: #ff5d00 !important;
    background-color: transparent !important;
}

/* --- Selector Idioma Móvil (Banderas en Header) --- */
.mobile-lang-selector {
    display: none !important;
    position: relative;
    flex-shrink: 0;
    overflow: visible; /* CORRECCIÓN */
}
.current-lang { display: flex; align-items: center; cursor: pointer; padding: 5px 8px; border: 1px solid #ddd; border-radius: 6px; background-color: #fff; }
.current-lang img { width: 28px; height: auto; border-radius: 3px; display: block; }
.current-lang .arrow-down { font-size: 10px; color: #555; margin-left: 6px; transition: transform 0.2s ease; }
.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    list-style: none;
    padding: 5px;
    margin: 0;
    z-index: 1005;
    min-width: auto;
}

/* REGLA REFORZADA para mostrar dropdown móvil */
.mobile-lang-selector > .lang-dropdown.show {
    display: block !important;
}

/* Rotar flecha móvil */
.mobile-lang-selector .lang-dropdown.show ~ .current-lang .arrow-down, /* Cuando está abierto */
.mobile-lang-selector .current-lang:hover .arrow-down { /* Al hacer hover (opcional) */
    transform: rotate(180deg);
}
.lang-dropdown li { margin: 0; }
.lang-dropdown li a { display: block; padding: 8px 10px; border-radius: 4px; }
.lang-dropdown li a img { width: 28px; height: auto; border-radius: 3px; display: block; }
.lang-dropdown li a:hover { background-color: #f4f4f4; }

/* ==========================================================================
    MEDIA QUERY PARA MÓVIL (MENÚ <= 768px)
    ========================================================================== */
@media (max-width: 768px) {
    .nav-links-desktop,
    .language-selector { display: none !important; }

    .menu-toggle,
    .mobile-lang-selector { display: flex !important; }

    .mobile-lang-selector {
        margin-right: 2px; }

    .navbar { background-color: #ffffff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    .menu-toggle .bar { background-color: #ffd500; }

    .nav-mobile { display: none; }
    .nav-mobile.active { display: flex !important; }
}