/* Estilos para el menú desplegable de categorías */

/* Contenedor del dropdown */
.dropdown-container {
    position: relative;
    cursor: pointer;
}

/* Hover effect para el contenedor */
.dropdown-container:hover .dropdown-trigger {
    color: inherit;
}

.dropdown-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Trigger del dropdown */
.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.dropdown-trigger:hover {
    color: inherit;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.dropdown-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Menú desplegable - Estilo con columnas */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: -20px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    min-width: auto;
    width: max-content;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: visible;
}

/* Triangulo indicador */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 40px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #ffffff;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto; /* Habilita interacción cuando está activo */
}

/* Contenido del dropdown */
.dropdown-content {
    padding: 20px 24px;
}

/* Header del menú */
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}

.dropdown-header-icon {
    width: 24px;
    height: 24px;
    color: #6b7280;
}

.dropdown-header-text h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
}

.dropdown-header-text p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Layout de columnas */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}

.category-column h4 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 20px 0;
}

/* Estado de carga */
.categories-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    color: #475569;
    font-size: 15px;
    font-weight: 500;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #0047AB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Lista de categorías - Sin scroll */
.categories-list {
    max-height: none;
    overflow: visible;
}

/* Items de categoría - Estilo columnas */
.category-item {
    margin-bottom: 8px;
    border-bottom: none;
    padding-bottom: 0;
    position: relative;
}

.category-item:last-child {
    margin-bottom: 0;
}

.category-parent {
    display: block;
    padding: 0;
    border-radius: 0;
    transition: none;
    background: transparent;
}

.category-link {
    color: #4b5563 !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    display: inline-block;
    padding: 10px 0;
    transition: color 0.15s ease;
    line-height: 1.5;
    text-shadow: none !important;
}

.category-link:hover {
    color: #1f2937 !important;
}

/* Ocultar botones de toggle en el estilo de columnas */
.submenu-toggle {
    display: none;
}

/* Submenús - Estilo limpio con sombra sutil */
.submenu {
    position: fixed;
    left: 100%;
    top: 0;
    margin-left: 12px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
    padding: 16px 20px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    min-width: auto;
    width: max-content;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
}

.submenu.active {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Hover effects mejorados para submenús */
.category-item:hover .submenu {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.subcategory-item:hover .submenu {
    max-height: 400px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.subcategory-item {
    margin-bottom: 6px;
    border-bottom: none;
}

.subcategory-item:last-child {
    margin-bottom: 0;
}

.subcategory-parent {
    display: block;
    padding: 0;
    border-radius: 0;
    transition: none;
    background: transparent;
}

.subcategory-parent:hover {
    background: transparent;
}

.subcategory-link {
    color: #4b5563 !important;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    flex: 1;
    transition: color 0.15s ease;
    line-height: 1.5;
    text-shadow: none !important;
    display: inline-block;
    padding: 8px 0;
}

.subcategory-link:hover {
    color: #1f2937 !important;
}

/* Subcategorías de tercer nivel - Capa independiente */
.submenu .submenu {
    position: fixed;
    left: 100%;
    top: 0;
    margin-left: 8px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    min-width: 250px;
    max-width: 300px;
    z-index: 1002;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.submenu .submenu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Asegurar que las subcategorías tengan posición relativa */
.subcategory-item {
    position: relative;
}

.submenu .subcategory-link {
    font-size: 15px;
    color: #4b5563 !important;
    font-weight: 500;
    text-shadow: none !important;
}

.submenu .subcategory-parent {
    padding: 8px 12px;
}

.submenu .subcategory-parent:hover {
    background: #f9fafb;
}

/* Mensaje de error */
.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 20px;
    color: #dc2626;
    font-size: 15px;
    font-weight: 500;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 280px;
        max-width: 320px;
    }
    
    .dropdown-content {
        padding: 12px;
    }
    
    .category-link {
        font-size: 13px;
    }
    
    .subcategory-link {
        font-size: 12px;
    }
    
    /* En móviles, deshabilitar hover effects y usar solo click */
    .category-item:hover .submenu {
        max-height: 0;
    }
    
    .subcategory-item:hover .submenu {
        max-height: 0;
    }
    
    .dropdown-container:hover .dropdown-trigger {
        color: inherit;
    }
    
    .dropdown-container:hover .dropdown-arrow {
        transform: none;
    }
    
    /* En móviles, submenús hacia abajo */
    .submenu {
        position: static;
        left: auto;
        top: auto;
        margin-left: 16px;
        margin-top: 8px;
    }
    
    .submenu .submenu {
        position: static;
        left: auto;
        top: auto;
        margin-left: 16px;
        margin-top: 4px;
    }
}

/* Animaciones suaves */
.category-item,
.subcategory-item {
    animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados activos */
.dropdown-trigger.active {
    color: inherit;
}

.dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
} 