/**
 * Menús desplegables mejorados con información visual de productos
 * Adaptado para animación slide-down + fade-in como en Withings
 */

/* === MENÚ DESPLEGABLE MEJORADO - TARJETA FULL WIDTH === */
.navbar-nav .dropdown-menu.enhanced {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    padding: 2.5rem 0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 
                0 2px 8px rgba(0, 0, 0, 0.08);
    border: none;
    border-top: 1px solid #e9ecef;
    background: #ffffff !important;
    margin-top: 0;
    top: 56px !important; /* Inicial, JS lo ajusta */
    height: auto !important;
    min-height: auto !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px); /* Slide inicial para Withings-style */
    transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                visibility 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Easing ease-out */
    display: block !important;
    pointer-events: none;
    z-index: 1030 !important;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Contenedor interno con max-width */
.navbar-nav .dropdown-menu.enhanced > li {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar-nav .dropdown-menu.enhanced > li.dropdown-menu-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

.navbar-nav .dropdown-menu.enhanced > li.dropdown-menu-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem 0;
    border-top: 1px solid #e9ecef;
    margin-top: 2rem;
}

.navbar-nav .dropdown-menu.enhanced.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important; /* Interactuable cuando está visible */
}

/* === HOVER PARA ABRIR MENÚS EN DESKTOP === */
@media (min-width: 992px) {
    .navbar-nav .dropdown-hover:hover > .dropdown-menu.enhanced,
    .navbar-nav .dropdown-hover > .dropdown-menu.enhanced:hover {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        display: block !important;
    }
    
    /* Asegurar que el menú se mantenga abierto cuando el mouse está sobre él */
    .navbar-nav .dropdown-hover .dropdown-menu.enhanced:hover {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }
}

/* === GRID DE PRODUCTOS EN MENÚ SIMPLIFICADO === */
.dropdown-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0;
}

.dropdown-product-item {
    background: transparent;
    border-radius: 0;
    padding: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: #212529;
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-product-item:hover {
    background: #f8f9fa;
    transform: none;
    box-shadow: none;
    color: #0d6efd;
    text-decoration: none;
    border-bottom-color: #0d6efd;
}

.dropdown-product-image {
    width: 100%;
    height: 100px;
    object-fit: contain;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    transition: opacity 0.2s ease;
}

.dropdown-product-item:hover .dropdown-product-image {
    opacity: 0.8;
}

.dropdown-product-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #212529;
    line-height: 1.4;
}

.dropdown-product-description {
    display: none;
}

.dropdown-product-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0d6efd;
    margin-top: 0.25rem;
}

.dropdown-product-badge {
    display: inline-block;
    background: #0d6efd;
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

/* === SECCIÓN DE CATEGORÍAS EN MENÚ === */
.dropdown-category-section {
    margin-bottom: 1.5rem;
}

.dropdown-category-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.dropdown-category-links {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dropdown-category-link {
    color: #495057;
    text-decoration: none;
    padding: 0.75rem 0.5rem;
    border-radius: 0;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-category-link:hover {
    background: #f8f9fa;
    color: #0d6efd;
    transform: none;
    text-decoration: none;
    border-bottom-color: #0d6efd;
}

.dropdown-category-link i {
    margin-right: 0.5rem;
    width: 18px;
    text-align: center;
}

/* === MENÚ DE SERVICIOS SIMPLIFICADO === */
.dropdown-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0;
}

.dropdown-service-item {
    background: transparent;
    border-radius: 0;
    padding: 1.25rem 1rem;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #212529;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border: none;
    border-right: 1px solid #f0f0f0;
    text-align: center;
}

.dropdown-service-item:last-child {
    border-right: none;
}

.dropdown-service-item:hover {
    background: #f8f9fa;
    transform: none;
    color: #0d6efd;
    text-decoration: none;
}

.dropdown-service-icon {
    font-size: 1.75rem;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #0d6efd;
    border-radius: 0;
    flex-shrink: 0;
    margin-bottom: 0.25rem;
}

.dropdown-service-content {
    flex: 1;
}

.dropdown-service-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0;
    color: #212529;
}

.dropdown-service-item:hover .dropdown-service-title {
    color: #0d6efd;
}

.dropdown-service-description {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
    display: none; /* Ocultar descripciones para simplificar */
}

/* === HEADER DEL MENÚ SIMPLIFICADO === */
.dropdown-menu-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.dropdown-menu-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.dropdown-menu-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 400;
}

/* === FOOTER DEL MENÚ === */
.dropdown-menu-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e9ecef;
    text-align: center;
}

.dropdown-menu-footer-link {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.dropdown-menu-footer-link:hover {
    color: #0b5ed7;
    transform: translateX(3px);
    text-decoration: none;
}

/* === ANIMACIONES SIMPLIFICADAS - ELIMINADAS === */
/* Las animaciones de entrada se han eliminado para un diseño más limpio y rápido */

/* === RESPONSIVE === */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu.enhanced {
        min-width: 100%;
        max-width: 100%;
        top: 56px !important; /* Valor inicial, se actualizará con JS */
        height: auto !important;
        min-height: auto !important;
        max-height: calc(100vh - 80px) !important;
        padding: 1.5rem 0;
        border-radius: 0 0 8px 8px;
    }
    
    .navbar-nav .dropdown-menu.enhanced > li {
        padding: 0 1.5rem;
    }
    
    .navbar-nav .dropdown-menu.enhanced > li.dropdown-menu-header {
        padding: 0 1.5rem 1rem;
    }
    
    .navbar-nav .dropdown-menu.enhanced > li.dropdown-menu-footer {
        padding: 1.5rem 1.5rem 0;
    }
    
    /* Ocultar submenús en móvil - se abren con clic */
    .dropdown-submenu-content {
        position: static !important;
        margin-left: 0 !important;
        margin-top: 0.5rem;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none;
        border: none;
        padding: 0.5rem 0 0 1.5rem;
    }
    
    .dropdown-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .dropdown-service-grid {
        grid-template-columns: 1fr;
    }
    
    .dropdown-service-item {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
}

@media (max-width: 768px) {
    .dropdown-products-grid {
        grid-template-columns: 1fr;
    }
    
    .dropdown-product-image {
        height: 100px;
    }
}

/* === SUBMENÚS MEJORADOS DE CATEGORÍAS === */
.dropdown-submenu-enhanced {
    position: relative;
    margin-bottom: 0.5rem;
}

.dropdown-toggle-enhanced {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
}

.dropdown-toggle-enhanced .fa-chevron-right {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    color: #6c757d;
}

.dropdown-submenu-enhanced:hover .dropdown-toggle-enhanced .fa-chevron-right {
    transform: translateX(5px);
    color: #0d6efd;
}

.dropdown-submenu-content {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 300px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    margin-left: 1rem;
}

.dropdown-submenu-enhanced:hover .dropdown-submenu-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Asegurar que el submenú se mantenga abierto cuando el mouse está sobre él */
.dropdown-submenu-content:hover {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

/* Ajustar posición en el borde derecho */
.dropdown-submenu-enhanced:last-child .dropdown-submenu-content,
.dropdown-submenu-enhanced:nth-last-child(2) .dropdown-submenu-content {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 1rem;
}

/* === MEJORAS DE ACCESIBILIDAD === */
.dropdown-product-item:focus,
.dropdown-service-item:focus,
.dropdown-category-link:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* === CONTENEDOR DE CATEGORÍAS EN MENÚ === */
.dropdown-menu.enhanced .dropdown-category-links {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.dropdown-menu.enhanced .dropdown-category-links::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu.enhanced .dropdown-category-links::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.dropdown-menu.enhanced .dropdown-category-links::-webkit-scrollbar-thumb {
    background: #0d6efd;
    border-radius: 3px;
}

.dropdown-menu.enhanced .dropdown-category-links::-webkit-scrollbar-thumb:hover {
    background: #0b5ed7;
}

