/* -------------------------------- 
G2R Mining Solutions - Header CSS
Archivo: header.css
Descripción: CSS específico para el header reutilizable
-------------------------------- */

/* Asegurar que el body no interfiera con el desplegable */
body {
    overflow-x: hidden; /* Solo ocultar scroll horizontal */
}

/* Header y navegación */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1;
    background: transparent;
    overflow: visible; /* Asegurar que el desplegable no se corte */
}

nav {
    display: flex;
    padding: 15px 25px;
    justify-content: space-between;
    align-items: center;
    margin: 2% auto 0;
    max-width: var(--site-max-width);
    overflow: visible; /* Asegurar que el desplegable no se corte */
}

nav .nav_logo a {
    display: flex;
    gap: 15px;
    align-items: center;
}

nav .nav_logo a img {
    max-width: 150px;
}

nav .nav_logo h2 {
    color: var(--white-color);
    font-weight: 600;
    font-size: 32px;
}

nav ul {
    display: flex;
    gap: 15px; /* Espaciado aumentado para uniformidad */
    justify-content: center; /* Centrar los elementos */
    align-items: center;
}

nav ul li {
    display: inline-block;
    position: relative;
}

nav ul li a {
    text-decoration: none;
    display: block;
    padding: 10px 20px; /* Padding reducido para uniformidad */
    font-size: 18px;
    font-weight: 500;
    color: var(--white-color);
    border-radius: 30px;
    white-space: nowrap; /* Evitar que el texto se rompa */
}

nav ul li a::after {
    content: ""; 
    position: absolute; 
    left: 0; 
    bottom: -1%; 
    width: 0; 
    height: 2px; 
    background-color: transparent; 
    transition: width 0.7s ease, left 1s ease; 
}

nav ul li a:hover::after {
    background-color: #fff;
    width: 100%;
    left: 0;
}

nav label {
    font-size: 32px;
    color: var(--white-color);
    cursor: pointer;
}

label .menu_btn,
label .close_btn {
    display: none;
}

#click {
    display: none;
}

/* Header blanco (scroll) */
header.white {
    background: #fff;
    color: #6caf2c;
    padding-bottom: 0.5%; 
}

header.white ul {
    background: #fff;
    color: #6caf2c;
}

header.white ul li a {
    color: #6caf2c; 
}

header.white ul li a::after {
    content: ""; 
    position: absolute; 
    left: 0; 
    bottom: -1%; 
    width: 0; 
    height: 2px; 
    background-color: transparent; 
    transition: width 0.7s ease, left 1s ease; 
    color: #6caf2c; 
}

header.white ul li a:hover::after {
    background-color: #6caf2c;
    color: #6caf2c; 
    width: 100%;
    left: 0;
}

header.white .top-menu::after {
    background-color: #6caf2c;
}

header.white .usa-language-container .usa-language__link {
    color: #6caf2c;
}

header.white .usa-language-container .usa-language__link:hover {
    color: #fff;
}

header.white label .menu_btn,
label .close_btn {
    color: #000;
}

/* Top menu */
.top-menu {
    background-color: transparent; 
    color: white;
    height: 30px;
    margin: 0;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow: visible; /* Asegurar que el desplegable no se corte */
}

.top-menu::after {
    display: none !important;
}

.top-menu p {
    margin: 0;
    font-size: 18px;
}

.usa-language-container {
    position: absolute; /* Usar absolute para posicionarse relativo al header */
    top: 7px;
    right: 20px; /* Posición desde el borde derecho del header */
    font-size: 10px;
    overflow: visible; /* Asegurar que el desplegable no se corte */
    z-index: 1000; /* Asegurar que esté por encima */
}

.usa-language-container a p {
    position: relative;
    margin-left: -1rem;
    font-size: 12px;
    color: #000;
}

.usa-language__primary-item {
    position: relative;
}

.usa-language__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.usa-language__link .lang-flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.usa-language__link .lang-text {
    white-space: nowrap;
}

.usa-language__link:hover {
    border-color: #6caf2c;
    background-color: #6caf2c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 175, 44, 0.3);
}

.usa-language__link.active {
    background-color: #007bff;
    color: #000;
    border-color: #007bff;
}

.usa-language__submenu {
    position: absolute;
    width: 220px; /* Ancho aumentado para evitar cortes */
    top: 100%;
    right: 0; /* Posicionado desde la derecha */
    background-color: #fff;
    color: #000;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999; /* Z-index muy alto para asegurar que esté por encima de todo */
    display: none;
    padding: 8px 0;
    margin-top: 0px;
    /* Asegurar que no se corte */
    min-width: 200px;
    /* Forzar que se muestre completamente */
    max-height: none !important;
    overflow: visible !important;
    clip: none !important;
    clip-path: none !important;
}

.usa-language__submenu-item {
    padding: 0;
    width: 100%;
}

.usa-language__submenu-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 2px 8px;
}

.usa-language__submenu-item a .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.usa-language__submenu-item a .lang-name {
    font-weight: 500;
}

.usa-language__submenu-item a:hover {
    background-color: #f8f9fa;
    color: #6caf2c;
}

.usa-language__primary-item:hover .usa-language__submenu,
.usa-language__primary-item.active .usa-language__submenu,
.usa-language__submenu:not([hidden]) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Asegurar que el desplegable se muestre cuando no tiene el atributo hidden */
.usa-language__submenu[hidden] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.usa-language__submenu:not([hidden]) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Estado inicial en Desktop */
/* ========================================================
   SELECTOR DE IDIOMA MINIMALISTA (DESKTOP)
   ======================================================== */
.desktop-lang-picker {
    position: relative;
    display: inline-block;
    margin-left: 15px;
    z-index: 1001;
}

/* Cápsula moderna translúcida */
.lang-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 7px 14px;
    border-radius: 50px;
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap; /* Impide que el texto se quiebre en dos renglones */
}

.lang-pill .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.lang-pill .lang-arrow {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.lang-pill:hover {
    background: rgba(108, 175, 44, 0.9); /* Verde G2R al interactuar */
    border-color: #6caf2c;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 175, 44, 0.4);
}

/* Estado cuando el header hace scroll y pasa a blanco */
header.white .lang-pill {
    background: #f0f0f0;
    border-color: #ddd;
    color: #333;
}

header.white .lang-pill:hover {
    background: #6caf2c;
    color: #fff;
    border-color: #6caf2c;
}

/* Menú desplegable flotante */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 140px;
    padding: 8px 0;
    margin: 0;
    list-style: none;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}

.lang-dropdown[hidden] {
    display: none !important;
}

.lang-dropdown:not([hidden]) {
    display: block !important;
    animation: dropdownFade 0.2s ease forwards;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-dropdown li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: #333333 !important;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.lang-dropdown li a:hover {
    background: #f4f8ef;
    color: #6caf2c !important;
}

.lang-dropdown li a .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}

/* ========================================================
   COMPORTAMIENTO MOBILE
   ======================================================== */
.mobile-only-lang {
    display: none;
}

@media screen and (max-width: 1023px) {
    
}
/* Media Queries para Header */

/* Desktop específico para 1024px - Ajustar espaciado con nuevo enlace */
@media screen and (min-width: 1024px) and (max-width: 1200px) {
    nav ul {
        gap: 10px; /* Gap reducido para 1024px */
    }
    
    nav ul li a {
        padding: 8px 15px; /* Padding reducido para 1024px */
        font-size: 15px; /* Tamaño de fuente reducido */
    }
    
    nav .nav_logo h2 {
        font-size: 26px; /* Logo más pequeño */
    }
    
    nav .nav_logo a img {
        max-width: 120px; /* Logo más pequeño */
    }
}

/* Tablet y móvil - Aquí cambia el header a hamburguesa */
@media screen and (max-width: 1023px) {
    .desktop-lang-picker {
        display: none !important; /* Desaparece de la barra superior en móvil */
    }

    .mobile-only-lang {
        display: block;
        margin: 20px auto 10px;
        width: 100%;
        text-align: center;
    }

    .mobile-lang-box {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        background: rgba(255, 255, 255, 0.1);
        padding: 8px 18px;
        border-radius: 30px;
    }

    .mobile-lang-box button {
        background: none;
        border: none;
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }

    .mobile-lang-box span {
        color: rgba(255, 255, 255, 0.4);
    }

    /* Menú desplegable hamburguesa */
    nav ul {
        display: block;
        background: var(--dark-color);
        position: fixed;
        top: 0;
        right: -100%; /* Desplazamiento lateral */
        left: auto;
        width: 80%;
        max-width: 360px;
        height: 100vh;
        padding-top: 85px;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -8px 0 25px rgba(0,0,0,0.5);
        z-index: 998;
        overflow-y: auto; /* Si el contenido supera la altura, que se pueda desplazar */
    }

    /* Compactar los enlaces: menos margen/padding vertical para que el
       selector de idioma (último elemento) quede visible y elevado */
    nav ul li {
        display: block;
        width: 100%;
        padding: 4px 0;
        margin: 2px auto;
        text-align: center;
    }

    nav ul li a {
        font-size: 17px;
        padding: 8px 20px;
        color: var(--white-color);
    }

    nav ul li a:hover {
        background: rgba(108, 175, 44, 0.2);
    }

    #click:checked ~ ul {
        right: 0; /* Aparece solo al marcar el checkbox */
    }

    /* Mostrar el botón hamburguesa en móvil/tablet.
       Este archivo (header.css) carga después de inicio.css, por lo que su
       regla base label .menu_btn { display:none } anula la de inicio.css.
       Aquí lo volvemos visible explícitamente. */
    label .menu_btn {
        display: block;
        font-size: 32px;
    }

    #click:checked ~ label .close_btn {
        display: block;
    }

    #click:checked ~ label .menu_btn {
        display: none;
    }

    /* El botón debe quedar por encima del panel lateral (z-index 998) */
    nav label {
        position: relative;
        z-index: 999;
    }
}

/* Móvil */
@media screen and (max-width: 768px) {
    nav {
        padding: 20px 25px;
        margin: 1% auto 0;
    }
    
    nav .nav_logo a img {
        max-width: 120px;
    }
    
    nav .nav_logo h2 {
        font-size: 28px;
    }
    
    .usa-language-container {
        margin: 7px 10px 0 0;
        font-size: 9px;
    }
    
    .usa-language-container a p {
        font-size: 11px;
        margin-left: -0.5rem;
    }
    
    /* Mantener desplegable de idiomas funcionando en móvil */
    .usa-language-container {
        position: absolute !important;
        top: 7px !important;
        right: 10px !important;
        font-size: 9px !important;
        z-index: 1000 !important;
    }
    
    .usa-language__submenu {
        position: absolute !important;
        width: 140px !important;
        top: 100% !important;
        left: 0 !important;
        background-color: #fff !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        z-index: 9999 !important;
        display: none !important;
        padding: 8px 0 !important;
        margin-top: 5px !important;
        min-width: 120px !important;
        /* Forzar que se muestre completamente */
        max-height: none !important;
        overflow: visible !important;
        clip: none !important;
        clip-path: none !important;
    }
    
    .usa-language__primary-item:hover .usa-language__submenu,
    .usa-language__primary-item.active .usa-language__submenu {
        display: block !important;
    }
}

/* Móviles muy pequeños - Línea blanca eliminada completamente */

/* Móviles pequeños */
@media (max-width: 480px) {
    nav {
        padding: 15px 20px;
        margin: 0.5% auto 0;
    }
    
    nav .nav_logo a img {
        max-width: 100px;
    }
    
    nav .nav_logo h2 {
        font-size: 24px;
    }
    
    .usa-language-container {
        position: absolute !important;
        top: 5px !important;
        right: 5px !important;
        font-size: 8px !important;
        z-index: 1000 !important;
    }
    
    .usa-language-container a p {
        font-size: 10px;
        margin-left: -0.3rem;
    }
}