/* ============================================
   MENÚ HAMBURGUESA - CSS PARA ALINEACIÓN CORRECTA
   ============================================ */

/* Variables CSS para personalización */
:root {
    --menu-bg: #ffffff;
    --menu-text: #333333;
    --menu-border: #e0e0e0;
    --menu-hover: #f5f5f5;
    --menu-active: #05366b;
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --transition-speed: 0.3s;
}

/* ============================================
   ALINEACIÓN EN EL SECONDARY NAV
   ============================================ */

/* Asegurar que el secondary-nav use flexbox para alineación */
.secondary-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Wrapper del botón hamburguesa */
.mobile-menu-toggle-wrapper {
    display: none; /* Oculto por defecto en desktop */
    margin-left: auto; /* Lo empuja hacia la derecha */
    order: 999; /* Se asegura que esté al final */
}

/* Botón hamburguesa alineado */
.hamburger-header-btn {
    position: relative;
    width: 45px;
    height: 45px;
    background: var(--menu-bg);
    border: 2px solid var(--menu-border);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    padding: 8px;
    transition: all var(--transition-speed) ease;
    vertical-align: middle; /* Alineación vertical con otros elementos */
}

.hamburger-header-btn:hover {
    background: var(--menu-hover);
}

.hamburger-header-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 48, 100, 0.25);
}

/* Líneas del hamburguesa */
.hamburger-line {
    width: 22px;
    height: 2px;
    background-color: var(--menu-text);
    border-radius: 2px;
    transition: all var(--transition-speed) ease;
}

/* Animación hamburguesa cuando está abierto */
.hamburger-header-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-header-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-header-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Indicador de items en el carrito */
.cart-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #03003b;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    padding: 0 4px;
    z-index: 1;
}

/* ============================================
   MENÚ LATERAL (SIDEBAR)
   ============================================ */

.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 380px;
    height: 100vh;
    background: var(--menu-bg);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right var(--transition-speed) ease;
    z-index: 9999;
    overflow-y: auto;
    overflow-x: hidden;
}

.mobile-menu-sidebar.active {
    right: 0;
}

/* Header del menú */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(90deg, #001f3f, #004080, #0066cc);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-menu-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-speed);
}

.mobile-menu-close:hover {
    transform: rotate(90deg);
}

/* Contenido del menú */
.mobile-menu-content {
    padding: 10px 0;
}

/* Secciones del menú */
.mobile-menu-section {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--menu-border);
    padding-bottom: 15px;
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-title {
    padding: 10px 20px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Lista de navegación */
.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    position: relative;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: var(--menu-text);
    text-decoration: none;
    transition: background var(--transition-speed);
    font-size: 15px;
}

.mobile-nav-link:hover {
    background: var(--menu-hover);
    color: var(--menu-active);
    text-decoration: none;
}

.mobile-nav-link i:first-child {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Toggle de submenú */
.submenu-toggle {
    transition: transform var(--transition-speed);
}

.mobile-nav-item.submenu-open .submenu-toggle {
    transform: rotate(180deg);
}

/* Submenús */
.mobile-submenu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f9f9f9;
}

.mobile-nav-item.submenu-open .mobile-submenu {
    display: block;
}

.mobile-submenu li {
    border-top: 1px solid var(--menu-border);
}

.mobile-submenu a {
    display: block;
    padding: 10px 20px 10px 50px;
    color: var(--menu-text);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--transition-speed);
}

.mobile-submenu a:hover {
    background: var(--menu-hover);
    color: var(--menu-active);
    text-decoration: none;
}

.active-language,
.active-currency {
    color: var(--menu-active);
    font-weight: 600;
}

/* Sección del carrito */
.cart-count-badge {
    background: #03003b;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 8px;
}

/* Items del carrito móvil */
.mobile-cart-items {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 20px;
}

.mobile-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-cart-item:last-child {
    border-bottom: none;
}

.mobile-cart-img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.mobile-cart-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.mobile-cart-info {
    flex: 1;
}

.mobile-cart-info h5 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
}

.mobile-cart-price {
    color: #666;
    font-size: 13px;
}

.mobile-cart-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color var(--transition-speed);
}

.mobile-cart-remove:hover {
    color: #03003b;
}

/* Footer del carrito */
.mobile-cart-footer {
    padding: 15px 20px;
    background: #f9f9f9;
}

.mobile-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.total-price {
    color: var(--menu-active);
}

/* Botones móviles */
.btn-mobile {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-speed);
    margin-bottom: 10px;
}

.btn-mobile:last-child {
    margin-bottom: 0;
}

.btn-view-cart {
    background: white;
    color: var(--menu-active);
    border: 2px solid var(--menu-active);
}

.btn-view-cart:hover {
    background: var(--menu-active);
    color: white;
    text-decoration: none;
}

.btn-checkout {
    background: var(--menu-active);
    color: white;
    border: 2px solid var(--menu-active);
}

.btn-checkout:hover {
    background: #0056b3;
    border-color: #0056b3;
    text-decoration: none;
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
    z-index: 9998;
}

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

/* ============================================
   MEDIA QUERIES - RESPONSIVO
   ============================================ */

/* Desktop - Mantener menús originales */
@media (min-width: 992px) {
    /* Ocultar solo el botón hamburguesa en desktop */
    .mobile-menu-toggle-wrapper {
        display: none !important;
    }
    
    /* Asegurar que el sidebar y overlay estén ocultos */
    .mobile-menu-sidebar,
    .mobile-menu-overlay {
        display: none !important;
    }
    
    /* Los menús originales siguen visibles */
    #navigation1,
    #navigation2,
    #navigation3 {
        display: block !important;
    }
}

/* Tablet y móvil */
@media (max-width: 991px) {
    /* Mostrar el botón hamburguesa */
    .mobile-menu-toggle-wrapper {
        display: inline-block !important;
        vertical-align: middle;
    }
    
    /* Ajuste para que secondary-nav mantenga la alineación */
    .secondary-nav {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    /* El menú de categorías se mantiene visible pero ajustado */
    #navigation1 {
        flex: 0 0 auto;
    }
    
    /* Ocultar SOLO los menús de configuración y carrito */
    #navigation2,
    #navigation3 {
        display: none !important;
    }
    
    /* Prevenir scroll cuando el menú está abierto */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* Móvil pequeño */
@media (max-width: 576px) {
    .mobile-menu-sidebar {
        width: 90%;
        max-width: none;
    }
    
    .hamburger-header-btn {
        width: 40px;
        height: 40px;
    }
    
    .hamburger-line {
        width: 20px;
    }
    
    .mobile-cart-items {
        max-height: 200px;
    }
    
    /* Ajuste adicional para móviles muy pequeños */
    .secondary-nav {
        padding: 5px 0;
    }
    
    /* Reducir tamaño del botón Categories en móvil si es necesario */
    #navigation1 .toggle-button {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* Fix específico para tu sistema */
.menu-init {
    display: inline-block;
    vertical-align: middle;
}

/* Asegurar que en móvil los elementos estén bien alineados */
@media (max-width: 991px) {
    .menu-init#navigation1,
    .mobile-menu-toggle-wrapper {
        display: inline-block !important;
        vertical-align: middle;
    }
}

/* Animaciones */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

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

/* Clases de animación */
.animated {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

.fadeInRight {
    animation-name: slideInRight;
}

/* Scrollbar personalizado */
.mobile-menu-sidebar::-webkit-scrollbar {
    width: 5px;
}

.mobile-menu-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mobile-menu-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.mobile-menu-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}